就是API ISZoomed The IsZoomed function determines whether a window is maximized. BOOL IsZoomed( HWND hWnd // handle of window ); ParametershWndIdentifies the window. Return ValuesIf the window is zoomed, the return value is nonzero. If the window is not zoomed, the return value is zero.
if FORM1.FormState=wsMaximized如果是其它程序的窗口,就不能这样判断了。
给你个例子unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button2Click(Sender: TObject); private private procedure WMsyscommand(var msg : Twmsyscommand);message wm_syscommand; { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure Tform1.WMsyscommand(var msg : Twmsyscommand); begin if msg.CmdType = SC_MAXIMIZE then showmessage('现在最大化') else if msg.CmdType = SC_MINIMIZE then showmessage('现在最小化'); inherited; end;end.
有问题请发信息到我的E-mail:[email protected]
The IsZoomed function determines whether a window is maximized. BOOL IsZoomed( HWND hWnd // handle of window
);
ParametershWndIdentifies the window. Return ValuesIf the window is zoomed, the return value is nonzero.
If the window is not zoomed, the return value is zero.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
private
private
procedure WMsyscommand(var msg : Twmsyscommand);message wm_syscommand;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure Tform1.WMsyscommand(var msg : Twmsyscommand);
begin
if msg.CmdType = SC_MAXIMIZE then
showmessage('现在最大化')
else if msg.CmdType = SC_MINIMIZE then
showmessage('现在最小化');
inherited;
end;end.
这个法不行呀,你们试过了吗?