public
//托盘图标的返回消息
procedure MyIcoMesDo(var Msg : TMessage);Message MyIcoMes;
var PNotifyNotifyIconDataA; //托盘图标结构procedure Tform1.CreateIco();
begin
//建立“托盘”图标
New(PNotify);
PNotify^.Wnd:=f_main.Handle;
PNotify^.uID:=0;
PNotify^.uFlags:=NIF_ICON+NIF_MESSAGE+NIF_TIP;
PNotify^.hIcon:=f_main.Icon.Handle;
PNotify^.uCallbackMessage:=MyIcoMes; //返回的消息
PNotify^.szTip:='Hint提示';
Shell_NotifyIcon(NIM_ADD,PNotify);
end;
procedure Tform1.MyIcoMesDo(var Msg:TMessage);
begin
if Msg.LParam=WM_LBUTTONDBLCLK then
begin //双击图标
//自己的代码
end;
if (Msg.LParam=WM_RBUTTONUP) and f_main.Enabled then
begin //右键单击
//自己的代码
end;
end;
呵呵。晚了。加一句。按状态栏图即启动 natants
if msg。wparamlo=MyIcoMes then
begin
if Msg.LParam=WM_LBUTTONDBLCLK then
begin
shellexecute(form1,pchar(c:/natants.exe),nil,nil,sw_shownormal);
end;
if (Msg.LParam=WM_RBUTTONUP) and f_main.Enabled then
begin //右键单击
//自己的代码
end;