System Delphi

private
{ Private declarations }
procedure WMSyscommand(var msg: TWmSysCommand); message WM_SYSCOMMAND;
procedure WMSize( Var msg: TWMSize ); Message WM_SIZE;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMSyscommand(var msg: TWmSysCommand);
begin
case (msg.CmdType and $FFF0) of
SC_MINIMIZE: begin
ShowMessage('Window about to MINIMIZE');
end;
SC_RESTORE : begin
ShowMessage('Window about to RESTORE');
end;
SC_MAXIMIZE: begin
ShowMessage('Window about to MAXIMIZE');
end;
end;
inherited;
end;
procedure TForm1.WMSize(var msg: TWMSize);
begin
If msg.Sizetype = SIZE_MAXIMIZED then
ShowMessage('Window MAXIMIZED');
inherited;
end;