Home
Tutorials
Code Snippets
Code Samples
Downloads
The Forum
Links

The Blog
Our Projects
Guest Book
About
Contact

ShOuT b0X:
::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 

View thread "Detecting Windows Shutdown"

Author
Thread Post Reply | New Thread
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.
Post Reply | New Thread
::Top 5 Tutorials::
Embedded Python[40658]
UDP[33491]
Keyboard Hook[32667]
2D Rotated Rectangles Collision Detection[30372]
HTTP Proxy[21177]

::Top 5 Samples::
2D ColDet Rotated Rectangles[6357]
PS2 Mouse Driver[4181]
Reading FAT12[3415]
Wave Format Player[3244]
CodeGuru[3037]

::Link to RageStorm::

::Affiliates::
AngelCode
YOV408 Technologies
FireStorm


All rights reserved to RageStorm © 2009