procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND; //在Public部分声明
procedure TForm1.WMSysCommand;
begin
if (Msg.CmdType = SC_MINIMIZE) then
begin
//最小化消息
end
else
if (Msg.CmdType = SC_MAXIMIZE) then
begin
//最大化消息
end
else
if (Msg.CmdType = SC_RESTORE) then
begin
//还原消息
end;
DefaultHandler(Msg);//默认处理
end;