type
TForm1 = class(TForm)
private
procedure AppMessage(var Msg:TWMSYSCOMMAND);message WM_SYSCOMMAND;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.AppMessage(var Msg:TWMSYSCOMMAND);
begin
if msg.CmdType=sc_minimize then
showmessage('最小化')
else if Msg.CmdType = SC_Maximize then
showmessage('最大化');
inherited;
end;
end.
我从别处看到的。
implemention中
procedure TForm1.WMSysCommand(var message:TWMSysCommand);
begin
inherited;
if IsIconic(Application.Handle) = true then
begin
inherited;
ShowMessage('the window is minimized');
Sleep(100*100);//1,你确定是100秒吗?2,sleep的参数我看IDE提示是ms(毫秒)
form1.WindowState:=wsMaximized
end;
end;