procedure TForm1.WmMyNotify(var Msg: TMessage);
Var
Point: TPoint;
begin
case Msg.LParam of
WM_LBUTTONDOWN:
BEGIN
GetCursorPos(Point); //get mouse left down postion;
PopupMenu1.Popup(Point.X, Point.Y);
END;
WM_RBUTTONDOWN: ShowMessage('你在“托盘测试”程序中单击的是右键!');
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
//释放掉建立的托盘程序
Shell_NotifyIcon(NIM_DELETE, @NotifyIcon);
end;