谁能告诉我按窗口的最小化按钮应该扑获那个消息

解决方案 »

  1.   

    使用wm_syscommand消息来拦截窗口最大,最小化
    WM_SYSCOMMAND  
    uCmdType = wParam;        // type of system command requested 
    xPos = LOWORD(lParam);    // horizontal postion, in screen coordinates 
    yPos = HIWORD(lParam);    // vertical postion, in screen coordinates  uCmdType可以为下列值
    SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.
    SC_MINIMIZE (or SC_ICON) Minimizes the window.
      

  2.   

    private
        { Private declarations }
        procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage);
    begin
      if Msg.WParam= SC_MINIMIZE
      then ShowMessage('Get IT');
    end;
      

  3.   

    private
        { Private declarations }
        procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage);
    begin
      if Msg.WParam= SC_MINIMIZE  then 
      begin
        ;//作你要做的事情。
      end
      else
        inherited;//别忘了让其他wm_syscommand正常被处理拉!
    end;
      

  4.   

    procedure TForm1.AppMinimize(Sender: TObject);
    begin
    ……
    end;