[Lazarus] Lazarus and Windows messages

ik idokan at gmail.com
Mon Jul 2 21:00:05 CEST 2012


Hello,

It's the first time that I use Lazarus with Windows, and almost 10 years
since I last developed to Windows.

I'm trying to capture the windows message WM_QUERYENDSESSION (that exists
on JwaWinUser).

I did something like this:

TForm1 = class(TForm)
...
private
  procedure WMQueryEndSession(var Msg : TLMessage); message
WM_QUERYENDSESSION
...

end;
...

procedure TForm1.WMQueryEndSession(var Msg : TLMessage);
begin
  case Msg.lParam of
     ENDSESSION_CLOSEAPP : ShowMessage('Closing Application'); // Added it
by hand <-
http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890%28v=vs.85%29.aspx
     ENDSESSION_CRITICAL : ShowMessage('Critical reason');
     ENDSESSION_LOGOFF : ShowMessage('Log off');
  end;
  Msg.Result := 1;
end;
...

It looks like the message never fires.

I'm using Windows 7 64 bit, Lazarus 0.9.30.4 FPC 2.6.0 i386

What am I missing or doing wrong ?

Thanks,
Ido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120702/e872bd46/attachment-0002.html>


More information about the Lazarus mailing list