delphi的窗体最小话是不激发CM_SIZE的,
是触发CM_SYSCOMMAND的,他的wPara = SC_MINIMIZE,
我给你写了个例子;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Btn: TButton;
public
{ Public declarations }
procedure OnMin(Var Msg: TMessage);MESSAGE WM_SYSCOMMAND;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.OnMin(Var Msg: TMessage);
begin
if Msg.WParam= SC_MINIMIZE then
begin
Caption:= DateTimeToStr(Now);
end
else
inherited;
end;