procedure TfrmMain.FormCreate(Sender: TObject);
begin
ntid.cbSize := sizeof(tnotifyicondataa);
ntid.Wnd := handle;
ntid.uID := iid;
ntid.uFlags := nif_icon + nif_tip + nif_message;
ntid.uCallbackMessage := mymsg;
ntid.hIcon := image1.Picture.Icon.handle;
ntid.szTip := '备忘录定时提醒...';
shell_notifyicona(NIM_ADD, @ntid);
.......
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
shell_notifyicona(NIM_Delete, @ntid);
end;
begin
ntid.cbSize := sizeof(tnotifyicondataa);
ntid.Wnd := handle;
ntid.uID := iid;
ntid.uFlags := nif_icon + nif_tip + nif_message;
ntid.uCallbackMessage := mymsg;
ntid.hIcon := image1.Picture.Icon.handle;
ntid.szTip := '备忘录定时提醒...';
shell_notifyicona(NIM_ADD, @ntid);
.......
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
shell_notifyicona(NIM_Delete, @ntid);
end;
将程序加入Windows 95/98/NT 桌面整理列 (Tray) 的构件,支持动画图标 ( ICON ) 等多项功能 ( 3.0.0 版,附源码 ),作者 : Troels Jakobsen。 http://vcl.vclxx.org/DELPHI/D32FREE/CTRAYICN.ZIP
将程序加入Windows 95/NT 桌面整理列 ( Tray ) 的构件,可使用在一般的 TForm 或ActiveXForm上,但若要在ActiveXForm上使用,则须先执行 TrayIcon.WHandle := Self.Handle,然後再把 TrayIcon.Active 设成 True 即可,( 附源码 ),作者 : 陈晋福。http://vcl.vclxx.org/DELPHI/D32FREE/DCMINTRAY.ZIP
TDCMinTray 是将程序加入Windows 95/98/NT 桌面整理列 ( Tray ) 的构件 ( 1.0 版,附源码 ),作者 : Dream Company。 还有好多,自己找找!!
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI, Menus;
const
WM_TrayMessage=WM_User+100;
type
TForm1 = class(TForm)
pmTray: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure N1Click(Sender: TObject);
protected
procedure AppMinimized(Sender: TObject);
procedure WMTrayMessage(var msg:TMessage);message WM_TrayMessage;
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
NID:TNotifyIconData;implementation{$R *.DFM}{ TForm1 }procedure TForm1.AppMinimized(Sender: TObject);
begin
NID.cbSize:=SizeOf(TNotifyIconData);
NID.hIcon:=Application.Icon.Handle;
//NID.szTip:= '彩虹2.0 Beta ';
NID.uCallbackMessage:=WM_TrayMessage;
NID.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
NID.uID:=0;
NID.Wnd:=Handle;
Shell_NotifyIcon(NIM_ADD,@NID);
ShowWindow(Application.Handle,SW_Hide);
end;procedure TForm1.WMTrayMessage(var msg: TMessage);
var
p:TPoint;
begin
if msg.LParam=WM_LButtonDown then
begin
ShowWindow(Application.Handle,SW_Show);
Application.Restore;
end
else if msg.LParam=WM_RButtonDown then
begin
GetCursorPos(p);
pmTray.Popup(p.x,p.y);
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMinimize:=AppMinimized;
AppMinimized(nil);
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE,@NID);
end;procedure TForm1.N1Click(Sender: TObject);
begin
ShowWindow(Application.Handle,SW_Show);
Application.Restore;
end;end.
注释一下么,万分感谢。 分没问题。