const
WM_TRAYNOTIFY=wm_user+$1024;procedure WMTrayNotify(var Msg:TMessage);message WM_TRAYNOTIFY;procedure TForm1.WMTrayNotify(var Msg:TMessage);
var NT:TNotifyIconData;
P:TPoint;
begin
GetCursorPos(P);
if (Msg.LParam=WM_RBUTTONUP) then PopupMenu1.Popup(p.x,p.y);
if (Msg.lParam<>WM_LBUTTONUP) then exit;
with NT do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
UID:=MY_TRAY_ICON;
uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
uCallBackMessage:=WM_TRAYNOTIFY;
hIcon:=LoadIcon(hInstance,'CDROM');// 此处需要修改;
szTip:=#0;
end;
Shell_NotifyIcon(NIM_DELETE,@NT);
ShowWindow(Application.Handle,SW_SHOW);
Application.Restore;
end;
WM_TRAYNOTIFY=wm_user+$1024;procedure WMTrayNotify(var Msg:TMessage);message WM_TRAYNOTIFY;procedure TForm1.WMTrayNotify(var Msg:TMessage);
var NT:TNotifyIconData;
P:TPoint;
begin
GetCursorPos(P);
if (Msg.LParam=WM_RBUTTONUP) then PopupMenu1.Popup(p.x,p.y);
if (Msg.lParam<>WM_LBUTTONUP) then exit;
with NT do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle;
UID:=MY_TRAY_ICON;
uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
uCallBackMessage:=WM_TRAYNOTIFY;
hIcon:=LoadIcon(hInstance,'CDROM');// 此处需要修改;
szTip:=#0;
end;
Shell_NotifyIcon(NIM_DELETE,@NT);
ShowWindow(Application.Handle,SW_SHOW);
Application.Restore;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货