使用wm_syscommand消息来拦截窗口最大,最小化 WM_SYSCOMMAND uCmdType = wParam; // type of system command requested xPos = LOWORD(lParam); // horizontal postion, in screen coordinates yPos = HIWORD(lParam); // vertical postion, in screen coordinates uCmdType可以为下列值 SC_MAXIMIZE (or SC_ZOOM) Maximizes the window. SC_MINIMIZE (or SC_ICON) Minimizes the window.
private { Private declarations } procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage); begin if Msg.WParam= SC_MINIMIZE then ShowMessage('Get IT'); end;
private { Private declarations } procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage); begin if Msg.WParam= SC_MINIMIZE then begin ;//作你要做的事情。 end else inherited;//别忘了让其他wm_syscommand正常被处理拉! end;
procedure TForm1.AppMinimize(Sender: TObject); begin …… end;
WM_SYSCOMMAND
uCmdType = wParam; // type of system command requested
xPos = LOWORD(lParam); // horizontal postion, in screen coordinates
yPos = HIWORD(lParam); // vertical postion, in screen coordinates uCmdType可以为下列值
SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.
SC_MINIMIZE (or SC_ICON) Minimizes the window.
{ Private declarations }
procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage);
begin
if Msg.WParam= SC_MINIMIZE
then ShowMessage('Get IT');
end;
{ Private declarations }
procedure GetIT(var Msg: TMessage);message WM_SYSCOMMAND;procedure TForm1.GetIT(var Msg: TMessage);
begin
if Msg.WParam= SC_MINIMIZE then
begin
;//作你要做的事情。
end
else
inherited;//别忘了让其他wm_syscommand正常被处理拉!
end;
begin
……
end;