惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
博客园_首页
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium
量子位
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
InfoQ
J
Java Code Geeks
T
Tailwind CSS Blog
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
腾讯CDC

博客园 - shaoyun

Python抓取百度搜索结果 多线程采集器的核心代码 ThinkPHP2.1模版使用笔记 - 模版嵌套/AJAX级联 畅想无线显示技术 ASP.Net 一步一步学习分页(适合初学者) - shaoyun - 博客园 OAuth协议分析一 通用四级联动下拉列表 通用手动分页方法 通用三级联动下拉列表 Indy 邮件发送的例子 Indy 组件学习注意事项 利用API的消息发送程序原理 Delphi DLL 的编写 Discuz!NT3.1 子目录安装实例 Delphi ADO 学习笔记 SQL获取数据表的空间占用 C#编写简单的系统服务管理器 很久没有写博了,发发挠骚 Twitter被封后教你继续访问的方法
Delphi 托盘程序示例
shaoyun · 2010-03-17 · via 博客园 - shaoyun

 1 // Code By Shaoyun 2010-03-16
 2 
 3 unit Unit1;
 4  
 5 interface
 6  
 7 uses
 8 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 9 Dialogs, ShellAPI;
10  
11 const
12 WIM_NID=WM_USER + 1001;
13  
14 type
15      TForm1 = class(TForm)
16      procedure FormCreate(Sender: TObject);
17      procedure FormDestroy(Sender: TObject);
18      private
19      { Private declarations }
20      public
21      { Public declarations }
22      procedure ProcessNotifyMessage(var msg:TMessage);message WIM_NID;
23 end;
24  
25 var
26      Form1: TForm1;
27      NotifyIcon : TNotifyIconData;
28  
29 implementation
30  
31 {$R *.dfm}
32  
33 procedure TForm1.FormCreate(Sender: TObject);
34 begin
35      with NotifyIcon do
36      begin
37           cbSize:= SizeOf(TNotifyIconData);
38           Wnd:= Handle;
39           uID := 1;
40           uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
41           uCallbackMessage := WIM_NID;
42           hIcon := Application.Icon.Handle;
43      end;
44      StrPCopy(NotifyIcon.szTip,Application.Title);
45      Shell_NotifyIcon(NIM_ADD,@NotifyIcon);
46 end;
47  
48 procedure TForm1.ProcessNotifyMessage(var msg:TMessage);
49 begin
50      case msg.LParam of
51           WM_LBUTTONDBLCLK: Form1.Visible := not Form1.Visible;
52           WM_RBUTTONUP: ShowMessage('你点击了右键!');
53      end;
54 end;
55  
56 procedure TForm1.FormDestroy(Sender: TObject);
57 begin
58      Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);
59 end;
60  
61 end.

posted @ 2010-03-17 02:10  shaoyun  阅读(696)  评论()    收藏  举报