if Message.WParam = SC_ICON then
  begin
    //Èç¹ûÓû§×îС»¯´°¿ÚÔò½«´°¿ÚÒþ²Ø²¢ÔÚÈÎÎñÀ¸ÉÏÌí¼Óͼ±ê
    lpData := new(PNotifyIconDataA);
    lpData.cbSize := 88;
    //SizeOf(PNotifyIconDataA);
    lpData.Wnd := MainForm.Handle;
    lpData.hIcon := Application.Icon.Handle;
    lpData.uCallbackMessage := WM_BARICON;   !!!!!注意此处
    lpData.uID :=0;
    lpData.szTip := '±¾µØÍø»°Îñ²ÎÊý»ã×ܳÌÐò';
    lpData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
    Shell_NotifyIcon(NIM_ADD,lpData);
    dispose(lpData);
    MainForm.Visible := False;
  end
procedure TMainForm.WMBarIcon(var Message :TMessage);
var
  pt:TPOINT;
begin  //»ñÈ¡Êó±êµÄÔÚÆÁÄ»ÉϵÄλÖÃ
  GetCursorPos(pt);  case Message.LParam of
    WM_LBUTTONDOWN:
    begin
      RestoreWindow;
    end;
    WM_RBUTTONDOWN:
    begin
      PopupMenu.Popup(pt.x,pt.y); //弹出菜单
    end;
  end;
end;