截获WM_SYSCOMMAND消息。
窗体的类声明如下:
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure WMSysCommand(var Message: TWMSysCommand);message WM_SYSCOMMAND;//响应WM_SYSCOMMAND消息
end;
WMSysCommand的实现如下:
procedure TForm.WMSysCommand(var Message: TWMSysCommand);
begin
Inherited;//调用先前的处理函数
if (Message.CmdType and $FFF0 = SC_MINIMIZE) then
... //自己的处理
end;