G
Guest
I have an application running in the background, visible only by a notify
icon in the system tray. I learned from other posts to catch the
WM_QUERYENDSESSION and WM_ENDSESSION messages. Now, when I want to
shutdown/restart the computer the application exits but the shutdown process
does not continue anymore. Here's what I've done:
protected override void WndProc(ref Message m)
{
// Exit message code.
int WM_QUERYENDSESSION = 0x11;
int WM_ENDSESSION = 0x16;
if (m.Msg == WM_QUERYENDSESSION || m.Msg == WM_ENDSESSION)
{
base.WndProc(ref m);
this.Close();
}
else
{
base.WndProc(ref m);
}
}
The MainForm is started in normal state and is set to invisible after start.
PLEASE HELP ME!
icon in the system tray. I learned from other posts to catch the
WM_QUERYENDSESSION and WM_ENDSESSION messages. Now, when I want to
shutdown/restart the computer the application exits but the shutdown process
does not continue anymore. Here's what I've done:
protected override void WndProc(ref Message m)
{
// Exit message code.
int WM_QUERYENDSESSION = 0x11;
int WM_ENDSESSION = 0x16;
if (m.Msg == WM_QUERYENDSESSION || m.Msg == WM_ENDSESSION)
{
base.WndProc(ref m);
this.Close();
}
else
{
base.WndProc(ref m);
}
}
The MainForm is started in normal state and is set to invisible after start.
PLEASE HELP ME!