Delphi 2009 - Handle when window is restored by double-clicking on SysMenu?

I need to handle when the user restores the form by double-clicking the title bar. I tried to process the message of the WM_SYSCOMMAND window, however this only works if the user restores the form by clicking the restore button in the system menu.

I use DevExpress tape form components if that matters.

Thanks.

+3
source share
2 answers

, , .
WM_SYSCOMMAND :

Message posted: hwnd=$004E0820 WM_NCLBUTTONDBLCLK wParam $00000002 lParam $000705D4 Process Project1.exe (2380)
=> Message sent: hwnd=$004E0820 WM_SYSCOMMAND restore cmd requested (-44,-44) Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_WINDOWPOSCHANGING wParam $00000000 lParam $0012F4CC Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_GETMINMAXINFO wParam $00000000 lParam $0012EF6C Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_NCCALCSIZE wParam $00000001 lParam $0012F4A0 Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_NCPAINT update region  40040F4B Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_ERASEBKGND wParam $31011DCA lParam $00000000 Process Project1.exe (2380)
Message sent: hwnd=$004E0820 WM_WINDOWPOSCHANGED wParam $00000000 lParam $0012F4CC Process Project1.exe (2380)

, CmdType const SC_RESTORE2= 61730//0xF122 Windows.pas.

. :

type
  TForm7 = class(TForm)
  private
    procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;
  end;

var
  Form7: TForm7;

implementation

{$R *.dfm}

{ TForm7 }

const
  SC_RESTORE2 = 61730; //0xF122

procedure TForm7.WMSysCommand(var Message: TWMSysCommand);
begin
  case Message.CmdType of
    SC_RESTORE2 : beep;
  end;
  inherited;
end;

: SC_RESTORE2 WM_SYSCOMMAND MSDN (. " #" )

+6

- ...

, - Windows.pas, SC_RESTORE2 . , SC_RESTORE2 WinUser.h. , (, , ) , wParam (Message.CmdType) $FFF0. François, " #", , SC_RESTORE2. , SC_RESTORE2 $FFF0 = SC_RESTORE.

+2

Source: https://habr.com/ru/post/1718389/


All Articles