加个ApplicationEvents,添加以下代码procedure TfrmMain.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_RESTORE) then //还原
begin
ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end
else if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_CLOSE) then //关闭
begin
ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end
else if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_MINIMIZE) then //最小化
begin
//ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end;
end;
var Handled: Boolean);
begin
if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_RESTORE) then //还原
begin
ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end
else if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_CLOSE) then //关闭
begin
ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end
else if (Msg.message = WM_SYSCOMMAND) and
(Msg.wParam = SC_MINIMIZE) then //最小化
begin
//ShowMessage(inttostr(msg.wParam)+' '+inttostr(WM_SYSCOMMAND));
//做你想做的事
Handled := True;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货