Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OnQueryEndSession and ENDSESSION_LOGOFF

183 views
Skip to first unread message

Noël Danjou

unread,
Jul 29, 2001, 6:10:31 AM7/29/01
to
Hello,

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

David Lowndes

unread,
Jul 29, 2001, 5:09:34 PM7/29/01
to
>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.

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.

Noël Danjou

unread,
Jul 30, 2001, 3:44:03 AM7/30/01
to
Hello David,

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

David Lowndes

unread,
Jul 30, 2001, 9:08:44 AM7/30/01
to
>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.)

Hmm, not much use then :(

I recall some discussion along these lines a while back. Have you
searched Dejanews?

Noël Danjou

unread,
Jul 30, 2001, 9:18:55 AM7/30/01
to
Yes I ran some searches with Google or Copernic. I found many things about
WM_QUERYENDSESSION and ExitWindowsEx behavior but I did not find the answer
to my question.

Thanks.
--
Noël
http://noeld.com

Windows XP beta tester

0 new messages