[Lazarus] using WM_USER const and TMessage to press escape to minimize form.

Peter Williams pewilliams2010 at live.com
Mon Dec 27 12:09:13 CET 2010


Hi All,

I am trying to port some Delphi 5 or 7 (cannot recall which) to Lazarus.

What do I change WM_USER to? I am getting Identifier not found.

Here is the code:

main.pas

const
  WM_USER_APPLICATION_MINIMIZE = WM_USER+1;

// identifier not found WM_USER

type
[...]
  private
    { Private declarations }
     procedure OnUserAppMin(var M: TMessage);
       message WM_USER_APPLICATION_MINIMIZE;

procedure TForm1.OnUserAppMin(var M: TMessage);
begin
  Application.Minimize;
end; { OnUserAppMin }
{----------------------------------------------------------}

about.pas

procedure TForm2.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (key = VK_ESCAPE) then
  begin
    key := 0;
    PostMessage(Form1.Handle, WM_USER_APPLICATION_MINIMIZE, 0, 0);

// error : Identifier not found WM_USER_APPLICATION_MINIMIZE

    close;
  end;
end; { FormKeyDown }
{----------------------------------------------------------}

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101227/8606cdc0/attachment-0002.html>


More information about the Lazarus mailing list