uses ShellApi;
var
ATray:PNotifyIconData;function AddTrayIcon(Handle:HWND;ICON:HICON;Hint:string):Boolean;
Begin
try
    New(ATray);
    ATray.cbSize:=Sizeof(ATray^);
    ATray^.Wnd:=Handle;
    ATray^.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
    ATray^.uCallbackMessage:=WM_TRAYICON;
    ATray^.hIcon:=Icon;
    strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_ADD,ATray);
  Except
Result:=False;
  end;
End;function ModiTrayIcon(Icon:HICON;Hint:string):Boolean;
begin
  try
    ATray^.hIcon:=Icon;
    strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_MODIFY,ATray);
  Except
Result:=False;
  end;
end;Function RemoveTrayIcon():Boolean;
Begin
try
Result:=Shell_NotifyIcon(NIM_DELETE,ATray);
  Except
Result:=False;
  end;
  Dispose(ATray);
End;