I managed that feature once, by cancelling all closing events (user had to select exit from menu). One way to overcome this is to detect the WM_QUERYENDSESSION message from windows
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if(!closing) // not ready to close yet
{
this.Hide(); // hide the window instead of closing it
e.Cancel = true;
}
}
Happy coding!
Morten Wennevik [C# MVP]
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.