...get notified when a Form is Minimized or Maximized?

Author: Thomas Stutz

Category: System

  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;

 

printed from
www.swissdelphicenter.ch
developers knowledge base