//声明部分
private
procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;
//实现部分
procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
if Message.CmdType = SC_MINIMIZE
then
begin
ShowMessage('Masd');//换成你要的
end;
Inherited;
end;