应用程序闲置时做的事情。比如要应用程序的窗口始终在所有窗口(包括已有的顶层窗口)的最前面,可以这样写:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure appOnIdle(Sender: TObject; var Done: Boolean);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.appOnIdle(Sender: TObject; var Done: Boolean);
begin
form1.FormStyle:=fsStayOnTop;
form1.BringToFront;
setForegroundWindow(handle);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
form1.FormStyle:=fsStayOnTop;
application.OnIdle:=appOnIdle;
end;
end.