[Lazarus] WM_QUERYENDSESSION
Bogusław Brandys
brandys at o2.pl
Wed Aug 6 21:23:02 CEST 2008
Luca Olivetti pisze:
> 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
More information about the Lazarus
mailing list