我想在点击窗口最小化按钮时触发某个事件,请教我该怎么做???

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
        ApplicationEvents1: TApplicationEvents;
        procedure ApplicationEvents1Minimize(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
    begin
    //这里写
    end;end.
      

  2.   

    public
        { Public declarations }
        procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
    procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
    begin
      if (Msg.CmdType = SC_MINIMIZE) or (Msg.CmdType = SC_MAXIMIZE) then
      begin
        // your code ............
        showmessage('hello');
      end;
      DefaultHandler(Msg);
    end;
      

  3.   

    madyak的方法好像不行,可能是我这边程序的问题,用hongqi162的方法搞定了,感谢各位!
      

  4.   

    ApplicationEvents1
    是控件面板上additional上的一个组件