Sign in Join

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

Mailing lists / lazarus / 2010-12

using WM_USER const and TMessage to press escape to minimize form.

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Peter Williams

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.freepascal.org/pipermail/lazarus/attachments/20101227/8606cdc0/attachment.html>

Reply by email

Roberto Padovani
to Peter Williams

2010/12/27 Peter Williams :

Show quoted text 14 lines
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

Add the following use clause:

uses Windows;

R#

Reply by email