procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
  showmessage('ok');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
  application.OnMinimize:=ApplicationEvents1Minimize;
end;end.以上代码不行啊??
最小化后并没有弹出 'ok', 当最小化到任务栏时,我用书标点击才发生??  

解决方案 »

  1.   

    procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;procedure TFrmMain.WMSysCommand;
    begin
      Case Msg.CmdType of
         SC_MINIMIZE:  xxx;//你要的操作..
    end;
    end;
      

  2.   

    定义//procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
    procedure Tfrmmain.ApplicationEvents1Minimize();
    begin
      showmessage('ok');
    end;
    procedure TFrmMain.WMSysCommand;
    begin
      Case Msg.CmdType of
         SC_MINIMIZE:  ApplicationEvents1Minimize();
               
    end;
    end;
      

  3.   

    上面有一点小错误定义//procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
    procedure Tfrmmain.ApplicationEvents1Minimize();
    begin
      showmessage('ok');
    end;
    procedure TFrmMain.WMSysCommand;
    begin
      Case Msg.CmdType of
         SC_MINIMIZE:  ApplicationEvents1Minimize();
         inherited;////********************不能忘;否则不会执行期望的操作      
    end;
    end;
      

  4.   

    procedure Tfrmmain.ApplicationEvents1Minimize();
    begin
      showmessage('ok');
    end;
    procedure TFrmMain.WMSysCommand;
    begin
         Inherited;
         Case Msg.CmdType of
         SC_MINIMIZE:  ApplicationEvents1Minimize();
               
    end;
    end;
      

  5.   

    还有我感觉把Inherited;放在前面不好啊。
    bw1996(bw) 兄:为什么要放在前面呢?
      

  6.   

    不一样啊..
    一个是做完再发给WINPROC..
    一个是做完WINPROC再做啊..