如何知道窗体失去焦点?(50分)

  • 主题发起人 主题发起人 Dark Angel
  • 开始时间 开始时间
D

Dark Angel

Unregistered / Unconfirmed
GUEST, unregistred user!
窗体失去焦点时会得到什么消息?<br>或是Delphi 中有没有处理窗体失去焦点时的过程?
 
form的onDeactivate事件
 
OnDeactivate occurs when the form loses focus.<br><br>TNotifyEvent = procedure(Sender: TObject) of object;<br>property OnDeactivate: TNotifyEvent;<br><br>Description<br><br>Use OnDeactivate to perform special processing when the<br>form transitions from being the active form to another<br>form in the same application becoming the active form.<br>If activation goes to another application, this event <br>is not triggered. To determine if another application has<br>become active, Use the TApplication object抯 OnDeactivate<br>event.<br>
 
Htw 的更详细点,不过大家都有功劳,小弟在此谢过了!
 
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls, ComCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Edit1: TEdit;<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; &nbsp; procedure WMACTIVATEAPP( var message:TWMACTIVATEAPP); message WM_ACTIVATEAPP;<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>procedure TForm1.WMACTIVATEAPP(var message: TWMACTIVATEAPP);<br>begin<br>&nbsp; if Message.Active then<br>&nbsp; &nbsp; caption:='Form is Active'<br>&nbsp; else<br>&nbsp; &nbsp; caption:='Form is Not Active';<br>end;<br><br>end.<br><br>
 
后退
顶部