procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormPaint(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
{ 当小图标捕捉到鼠标事件时进入此过程 }
procedure TMainForm.OnIconNotify(var Message: TMessage);
var
Busy : Boolean;
begin
Busy := False;
if not Busy then
begin
Busy := True;
if Message.LParam=WM_LBUTTONDOWN then
if Application.MessageBox('真的要退出日志定时清楚程序吗?', '提示', MB_YESNO)=IDYES then
Close;
Busy := False;
end;
end;
nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有效
if not Shell_NotifyIcon(NIM_ADD,@nid) then
begin
ShowMessage('Failed!');
Application.Terminate;
end;
{ 将程序的窗口样式设为TOOL窗口,可避免在任务条上出现 }
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;