<div dir="ltr">Hello,<br><br>It's the first time that I use Lazarus with Windows, and almost 10 years since I last developed to Windows.<br><br>I'm trying to capture the windows message WM_QUERYENDSESSION (that exists on JwaWinUser).<br>
<br>I did something like this:<br><br>TForm1 = class(TForm)<br>...<br>private<br> procedure WMQueryEndSession(var Msg : TLMessage); message WM_QUERYENDSESSION<br>...<br><br>end;<br>...<br><br>procedure TForm1.WMQueryEndSession(var Msg : TLMessage);<br>
begin<br> case Msg.lParam of<br> ENDSESSION_CLOSEAPP : ShowMessage('Closing Application'); // Added it by hand <- <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890%28v=vs.85%29.aspx</a><br>
ENDSESSION_CRITICAL : ShowMessage('Critical reason');<br> ENDSESSION_LOGOFF : ShowMessage('Log off');<br> end;<br> Msg.Result := 1;<br>end;<br>...<br><br>It looks like the message never fires.<br>
<br>I'm using Windows 7 64 bit, Lazarus 0.9.30.4 FPC 2.6.0 i386<br><br>What am I missing or doing wrong ?<br><br>Thanks,<br>Ido<br>
</div>