多春鱼小屋

登录
记住密码
  1. 首页
  2. Delphi重建托盘图标
Delphi重建托盘图标
发布 | 2022-7-24 | 评论数:0 | 阅读数:2992 | 标签:Delphi
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重新载入的时候,本程序在任务栏的图标又重现了。

分享至:

本文已关闭评论

  • 评论0
  • 粉丝1
  • 文章33

    • 多春鱼
    • 广州
    • 1970年2月26日
    • 联系 :capelin@qq.com 微信:imcapelin
    • 查看更多 >
    热门文章
    标签
    Delphi Android PHP Tools