| Author |
|
| Views: 2260 | Replies:
3 | Posting Date: 2006-08-24 10:45:33
|
Thread Starter:
Lastexiledjedi |
Hi,
I'm having trouble with detecting Windows shutdown from my Win32 windows Application. This is the code I'm using:
case WM_QUERYENDSESSION: //detects windows shutdown { ErrorMessage("Windows is shutting down. Terminating the program" ; SendMessage(hWnd,WM_DESTROY,0,0); break; }
It doesn't work... please help... Also, would I use the same thing to detect the reboot and user logoff? I would appreciate any help... Thanks~
|
arkon Posted at: 2006-08-24 11:45:54 |
Re: Detecting Windows Shutdown
are you using mfc or something, or plain win32? if it's win32, from what thread your window was created?
and yes, you're supposed to use the same message for reboot and logoff, the inidication of which is what is found in the lparam. |
A Y Posted at: 2006-08-24 12:28:33 |
Re: Detecting Windows Shutdown
No it has MFC and the GUI starts directly from WinMain from where it goes into InitInstance and MyRegisterClass. Then finally i have the WndProc where I've included the WM_QUERYENDSESSION |
arkon Posted at: 2006-08-27 17:30:56 |
Re: Detecting Windows Shutdown
mfc might do problems with posted messages. |