实现WM_SYSCOMMAND消息: procedure TMainForm.WMSysCommand(var Message: TWMSysCommand); begin case Message.CmdType of SC_MINIMIZE: begin Exit; end else inherited; end; end;
procedure MyMsg(var msg:TMessage);message WM_SYSCOMMAND; ... procedure TForm1.MyMsg(var msg: TMessage); begin if msg.WParam=SC_MINIMIZE then msg.Result:=0 //最好处理一下。 else inherited; end;
加一个 ApplicationEvents 组件在窗体上,然后procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); begin if (msg.message=wm_syscommand) and (msg.wParam=sc_minimize) then handled:=true; end;
procedure TMainForm.WMSysCommand(var Message: TWMSysCommand);
begin
case Message.CmdType of
SC_MINIMIZE:
begin
Exit;
end else inherited;
end;
end;
...
procedure TForm1.MyMsg(var msg: TMessage);
begin
if msg.WParam=SC_MINIMIZE then
msg.Result:=0 //最好处理一下。
else
inherited;
end;
var Handled: Boolean);
begin
if (msg.message=wm_syscommand) and (msg.wParam=sc_minimize) then
handled:=true;
end;
ok