频道分类

delphi截获和干扰窗体最小化﹑最大化和关闭消息

作者:admin 来源: 日期:2020/3/23 9:00:50 人气: 标签:

 
type
  TForm1 = class(TForm)
  ......
  public
    { Public declarations }
    procedure WMSysCommand(var Message: TWMSysCommand);message WM_SYSCOMMAND;
end;

procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
  if (Message.CmdType and $FFF0 = SC_MINIMIZE){ or
     (Message.CmdType and $FFF0 = SC_CLOSE) or
     (Message.CmdType and $FFF0 = SC_MAXIMIZE)} then
    Form1.Visible:=False // 隐藏窗体
  else
    Inherited;
end;

http://blog.chinaunix.net/uid-20564848-id-74477.html