Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-07

WM_QUERYENDSESSION

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,
I see that in win32callback.inc, WM_QUERYENDSESSION filters by LParam=0. This allows me to block system shutdown or reboot (by setting cancel:=true in an ApplicationProperties OnQueryEndSession event) but *not* intercept session closing (since LParam is 0 in that case, see http://msdn.microsoft.com/en-us/library/aa376890.aspx). Maybe the lcl should pass on the message even if LParam is 0 (but it should give a wey to differentiate cases).
BTW, the same happens for WM_ENDSESSION, so the app isn't notified that the session is being closed.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

En/na Luca Olivetti ha escrit:

Show quoted text 10 lines
Hello, I see that in win32callback.inc, WM_QUERYENDSESSION filters by LParam=0. This allows me to block system shutdown or reboot (by setting cancel:=true in an ApplicationProperties OnQueryEndSession event) but *not* intercept session closing (since LParam is 0 in that case, see http://msdn.microsoft.com/en-us/library/aa376890.aspx). Maybe the lcl should pass on the message even if LParam is 0 (but it should give a wey to differentiate cases). BTW, the same happens for WM_ENDSESSION, so the app isn't notified that the session is being closed.

As a temporary solution, I just commented out the "and (LParam=0)" in win32callback.inc, both for WM_QUERYENDSESSION and for WM_ENDSESSION.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

En/na Luca Olivetti ha escrit:

Show quoted text 14 lines
En/na Luca Olivetti ha escrit: > Hello, > I see that in win32callback.inc, WM_QUERYENDSESSION filters by LParam=0. > This allows me to block system shutdown or reboot (by setting > cancel:=true in an ApplicationProperties OnQueryEndSession event) but > *not* intercept session closing (since LParam is 0 in that case, see > http://msdn.microsoft.com/en-us/library/aa376890.aspx). > Maybe the lcl should pass on the message even if LParam is 0 (but it > should give a wey to differentiate cases). > BTW, the same happens for WM_ENDSESSION, so the app isn't notified that > the session is being closed. As a temporary solution, I just commented out the "and (LParam=0)" in win32callback.inc, both for WM_QUERYENDSESSION and for WM_ENDSESSION.

No opinions on this? Should I file a bug or this is the intented behaviour. If the latter, what about catching session closing?

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Bogusław Brandys
to Luca Olivetti

Luca Olivetti pisze:

Show quoted text 19 lines
En/na Luca Olivetti ha escrit: > En/na Luca Olivetti ha escrit: >> Hello, >> I see that in win32callback.inc, WM_QUERYENDSESSION filters by LParam=0. >> This allows me to block system shutdown or reboot (by setting >> cancel:=true in an ApplicationProperties OnQueryEndSession event) but >> *not* intercept session closing (since LParam is 0 in that case, see >> http://msdn.microsoft.com/en-us/library/aa376890.aspx). >> Maybe the lcl should pass on the message even if LParam is 0 (but it >> should give a wey to differentiate cases). >> BTW, the same happens for WM_ENDSESSION, so the app isn't notified that >> the session is being closed. > As a temporary solution, I just commented out the "and (LParam=0)" in > win32callback.inc, both for WM_QUERYENDSESSION and for WM_ENDSESSION. No opinions on this? Should I file a bug or this is the intented behaviour. If the latter, what about catching session closing? Bye

Feel free to modify it.Maybe add variable Reason with default value endShutdown (=0) defined as constant so older code would be unchanged to

Application.IntfQueryEndSession(CancelEndSession);

so

{------------------------------------------------------------------------------

   procedure TApplication.IntfQueryEndSession(var Cancel : Boolean);

------------------------------------------------------------------------------}

in application.inc may become :

{------------------------------------------------------------------------------
   procedure TApplication.IntfQueryEndSession(var Cancel :
Boolean;Reason : Integer = endShutdown);
------------------------------------------------------------------------------}

?

Sorry,can't help much it was so long ago when I needed this message handler.

Regards
Boguslaw

Reply by email