怎样在双击标题栏时执行一段代码?
我想在双击标题时扫行一段代码,判断该窗体是最大化还是最小化,请问怎样实现,要发送什么消息!?

解决方案 »

  1.   

    用WM_SYSCOMMAND消息,判断msg.CmdType的值就可以了.
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
      private
      public
        procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
        procedure WMNCLBUTTONDBLCLK(var Msg: TWMSysCommand); message WM_NCLBUTTONDBLCLK;
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMNCLBUTTONDBLCLK(var Msg: TWMSysCommand);
    begin
      Case Msg.CmdType of
        SC_MINIMIZE:Showmessage('最小化');
        SC_MAXIMIZE:Showmessage('最大化');
        SC_RESTORE: Showmessage('恢复');
      end;
      Inherited;
    end;procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
    begin
      Case Msg.CmdType of
        SC_MINIMIZE:Showmessage('最小化');
        SC_MAXIMIZE:Showmessage('最大化');
        SC_RESTORE: Showmessage('恢复');
      end;
      Inherited;
    end;end.