发信人: limodou() 
整理人: yueqs(2000-12-05 19:56:32), 站内信件
 | 
 
 
【 在 mcmib (MIB) 的大作中提到: 】
 
 方法一:截获WM_SYSCOMMAND消息,看窗体是否处于最小化状态
 type
   TForm1 = class(TForm)
   private
      procedure WMSysCommand(var Message: TMessage); message WM_SYSCOMM AND;
   //...
   end;
 
 implementation
 
 {$R *.DFM}
 procedure TForm1.WMSysCommand(var Message:TMessage);
 begin
   if Message.WParam = SC_ICON then  //最小化了
   begin
   //form1.hide; ...
   end
   else
     inherited;
 end;
 
 方法二,直接判断是否点了窗体非客户区的最小化按钮
 type
   TForm1 = class(TForm)
   private
     procedure Minimize(var mess:TWMNCLBUTTONDOWN);message WM_NCLBUTTON DOWN;
   //...
   end;
 
 implementation
 
 {$R *.DFM}
 procedure TForm1.Minimize(var mess:TWMNCLBUTTONDOWN);
 begin
     if mess.hittest=htreduce then  //htreduce表示是否按了最小化按钮
     begin
     //Form1.hide; ...
     end
     else
         inherited;
 end;
 
  -- 新近开发了主页上传软件uploader 2.0beta版,欢迎大家下载使用。
 http://smallroom.126.com
  ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.99.51.244]
  | 
 
 
 |