Delphi撰寫縮小到系統列程式

在畫面上放置
1 ApplicationEvents
2 TrayIcon
3 PopupMenu

然後在ApplicationEvents1Minimize寫上

  Hide();
  WindowState := wsMinimized;
  TrayIcon1.Visible := True;
  TrayIcon1.Animate := True;
  TrayIcon1.ShowBalloonHint;

接著在TrayIcon的Click事件讓popupmenu顯示

var
  p : TPoint;
begin
  GetCursorPos(p);
  popupmenu1.Popup(p.X,p.Y);
end;

最後在popupmenu上的onclick加上

  Show;
  WindowState := wsMaximized;
  trayicon1.Visible := False;