News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Detect shutdown

Started by Ghirai, September 19, 2006, 08:16:55 AM

Previous topic - Next topic

Ghirai

Does anyone know the proper way to detect a shutdown/reboot?

I need to save some stuff in my application before allowing the system to halt.
I suspect it has something to do with the WM_POWERBROADCAST message?


Thanks.
MASM32 Project/RadASM mirror - http://ghirai.com/hutch/mmi.html

mnemonic

To keep it short, have a look in here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/exitwindows.asp
There are some messages that will be send on the logoff event.

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

TNick

For example, WM_QUERYENDSESSION

Tedd

WM_QUERYENDSESSION is sent to all processes to 'ask' if it's okay to shutdown (well, 'end the session' - which usually means shutdown, or just log-out.)
Assuming there are no objections, WM_ENDSESSION is sent to indicate the system will actually be shutting down (if there are objections it won't be sent, and the system won't be shutting down.)
No snowflake in an avalanche feels responsible.