I have 2 questions about WM_QUERYENDSESSION.
1. How one can test if the system is shutting down or logging off?
OnQueryEndSession() does not pass the value of lParam.
2. I have a "long" process to do in my application when WM_QUERYENDSESSION
is received so I return FALSE to cancel it and then I issue an
ExitWindowsEx() when I am done. But ExitWindowsEx() can accept not only
EWX_SHUTDOWN and EWX_LOGOFF but also EWX_POWEROFF and EWX_REBOOT. How can I
know from which of these 4 states the WM_QUERYENDSESSION was triggered
before I cancelled it?
Any ideas would be welcome. Thanks.
--
Noël
http://noeld.com
A couple of possibilities:
1. Use GetCurrentMessage to access the MSG structure.
2. Add an ON_MESSAGE handler for the message so that you can access
both the parameters.
>2. I have a "long" process to do in my application when WM_QUERYENDSESSION
>is received so I return FALSE to cancel it and then I issue an
>ExitWindowsEx() when I am done. But ExitWindowsEx() can accept not only
>EWX_SHUTDOWN and EWX_LOGOFF but also EWX_POWEROFF and EWX_REBOOT. How can I
>know from which of these 4 states the WM_QUERYENDSESSION was triggered
>before I cancelled it?
I don't know. Have you investigated whether the lParam value passed
with WM_QUERYENDSESSION corresponds to the parameter flags of
ExitWindowsEx ?
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
Thanks for your suggestions.
Yes I investigated the lParam from WM_QUERYENDSESSION and I received only
two different values either 0 (when I use EWX_SHUTDOWN, EWX_POWEROFF or
EWX_REBOOT), or 0x80000000 (ENDSESSION_LOGOFF, when I use EWX_LOGOFF.)
Thanks
--
Noël
http://noeld.com
Hmm, not much use then :(
I recall some discussion along these lines a while back. Have you
searched Dejanews?
Thanks.
--
Noël
http://noeld.com
Windows XP beta tester