请教!如何使按下窗口的最小化按钮时执行其他事项(50分)

  • 主题发起人 主题发起人 xminsong
  • 开始时间 开始时间
X

xminsong

Unregistered / Unconfirmed
GUEST, unregistred user!
是否要拦截该消息?如是,又是什么消息?先谢啦!
 
type
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMSysCommand(var Msg: TWMSysCommand);
message WM_SYSCOMMAND;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMSysCommand;
begin
if (Msg.CmdType = SC_MINIMIZE) then
//其它程序;
end;
 
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
Procedure WMSysCommand(Var message : TMessage) ;
Message WM_SYSCOMMAND ;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.DFM}
Procedure TForm1.WMSysCommand(Var Message : TMessage) ;
begin

if (Message.WParam = SC_MINIMIZE) then
begin
ShowMessage('hello');
end;

Inherited;
end;

end.
 
我试过了,zw84611对的,一定要有 Inherited,否则关闭不了窗口,谢谢!!
 
后退
顶部