这个问题答过很多次了,还有人问!
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ShellAPI,
StdCtrls, Menus;const
WM_TRAYNOTIFY = WM_USER+100;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure TrayNotifyMessage(var Sender: TMessage); message WM_TRAYNOTIFY;
procedure MarkTaskBarIcon(Sender: TObject);
public
{ Public declarations }
end;var
Form1: TForm1;
tnd : TNOTIFYICONDATA;
implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMinimize := MarkTaskBarIcon;
end;procedure TForm1.MarkTaskBarIcon(Sender: TObject);
begin
Form1.Visible := False;
tnd.cbSize := sizeof(tnd);
tnd.Wnd := Handle;
tnd.uID := 128;
tnd.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
tnd.uCallbackMessage := WM_TRAYNOTIFY;
tnd.hIcon := Application.Icon.Handle;
StrPCopy(tnd.szTip,Application.Title);
Shell_NotifyIcon(NIM_ADD,@tnd);
end;procedure TForm1.TrayNotifyMessage(var Sender: TMessage);
begin
if Sender.LParam = WM_LBUTTONDBLCLK then
begin
Shell_NotifyIcon(NIM_DELETE,@tnd);
Form1.Visible := True;
Application.Restore;
Application.BringToFront;
end;
if wm_size=1 then
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ShellAPI,
StdCtrls, Menus;const
WM_TRAYNOTIFY = WM_USER+100;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure TrayNotifyMessage(var Sender: TMessage); message WM_TRAYNOTIFY;
procedure MarkTaskBarIcon(Sender: TObject);
public
{ Public declarations }
end;var
Form1: TForm1;
tnd : TNOTIFYICONDATA;
implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMinimize := MarkTaskBarIcon;
end;procedure TForm1.MarkTaskBarIcon(Sender: TObject);
begin
Form1.Visible := False;
tnd.cbSize := sizeof(tnd);
tnd.Wnd := Handle;
tnd.uID := 128;
tnd.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
tnd.uCallbackMessage := WM_TRAYNOTIFY;
tnd.hIcon := Application.Icon.Handle;
StrPCopy(tnd.szTip,Application.Title);
Shell_NotifyIcon(NIM_ADD,@tnd);
end;procedure TForm1.TrayNotifyMessage(var Sender: TMessage);
begin
if Sender.LParam = WM_LBUTTONDBLCLK then
begin
Shell_NotifyIcon(NIM_DELETE,@tnd);
Form1.Visible := True;
Application.Restore;
Application.BringToFront;
end;
if wm_size=1 then
end;end.
解决方案 »
- 心情好 散下分
- WINDOWS多线程疑难
- 100分求答案!求汉字加密、解密方法,最好有源码,我搜索了一些帖子,没有能解决的帖子,解密时有乱码!
- 企业名称、注册地址的智能分词 (RMB1000元 )
- 请问DBGIRD中的右击菜单怎么做?
- 用TDrawGriD网格绘图出问题,在线等待!!
- ★■【200分,怎样用Delphi编写一个向ASP提交多行文本框的内容?----谢谢!】■★
- 通过idhttp访问网页报10054错误
- 三四十个客户要连接到sql server数据库,用三层结构还是二层呢?
- 如何通过IdHTTP.post下载一个文件
- dbgird控件---->"grid index out of range"
- 在adotable中的过滤器(filter),如何限制某一段时间之间的记录(在adoquery中用between可以)
我把它单独提出来,可以在delphi6下运行,要的话留下email.