unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,ShellAPI; const WM_TRAYNOTIFY = WM_USER+100; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } procedure TrayNotifyMessage(var Sender: TMessage); message WM_TRAYNOTIFY; procedure MarkTaskBarIcon(Sender: TObject); public { Public declarations } end; var Form1: TForm1; tnd : TNOTIFYICONDATA; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin Application.OnMinimize := MarkTaskBarIcon; end; procedure TForm1.MarkTaskBarIcon(Sender: TObject); begin Form1.Visible := False; tnd.cbSize := sizeof(tnd); tnd.Wnd := Handle; tnd.uID := 128; tnd.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP; tnd.uCallbackMessage := WM_TRAYNOTIFY; tnd.hIcon := Application.Icon.Handle; StrPCopy(tnd.szTip,Application.Title); Shell_NotifyIcon(NIM_ADD,@tnd); end; procedure TForm1.TrayNotifyMessage(var Sender: TMessage); begin if Sender.LParam = WM_LBUTTONDBLCLK then begin Shell_NotifyIcon(NIM_DELETE,@tnd); Form1.Visible := True; Application.Restore; Application.BringToFront; end; end; end.