unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure WndProc(var msg: Tmessage); override; //任务栏恢复消息(继承)
public { Public declarations }
end;
var Form1: TForm1;
TaskBarMSG: Dword; //任务栏恢复消息 implementation
{$R *.dfm} { TForm1 }
procedure TForm1.WndProc(var msg: Tmessage); //任务栏恢复消息
begin
if msg.msg = TaskBarMSG then
SetTryico(Handle, Icon.Handle, AppTray); //重设ICON
inherited WndProc(msg);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TaskBarMSG := RegisterWindowMessage("HTaskBarCreated"); //注册任务栏恢复消息
end;
end.
编译这个程序,然后用任务管理器或其他工具中止Explorer.exe,可以看到在Explorer重新载入的时候,本程序在任务栏的图标又重现了。
本文已关闭评论