1):Const
WM_BARICON=WM_USER+200;
2)
rivate
procedure WMBarIcon(var Message:TMessage);
message WM_BARICON;
3);
procedure TFrm_main.WMBarIcon(var Message:TMessage);
var
lpData
NotifyIconData;
begin
if (Message.LParam = WM_LBUTTONDBLCLK) or (Message.lparam=WM_LBUTTONDOWN) then
begin
//如果用户点击任务栏图标则将图标删除并回复窗口。
lpData := new(PNotifyIconDataA);
lpData.cbSize := 88;//SizeOf(PNotifyIconDataA);
lpData.Wnd := Frm_main.Handle;
lpData.hIcon := Frm_main.Icon.Handle;
lpData.uCallbackMessage := WM_BARICON;
lpData.uID :=0;
lpData.szTip := '意浪之zwglxt';
lpData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
Shell_NotifyIcon(NIM_DELETE,lpData);
dispose(lpData);
Frm_main.Visible := True;
end;
if (message.LParam=WM_RBUTTONDOWN) then
popupmenu1.Popup(mouse.CursorPos.x,mouse.CursorPos.y);
end;