¿qué componente estás usando para el TrayIcon?
Lo digo porque cada uno implementa o no una función. Usando estrictamente la API de windows, se puede conseguir lo que quieres, de hecho proporciona un campo donde incluir el texto a mostrar a modo de Hint.
Si el componente que usas lo permite (la licencia, tienes el código, etc) puedes hacerlo tú mismo. En caso contrario, usar uno de los muchos que sí lo tienen implementados (JVCL, LMDTOOLS,etc)
Código Delphi
[-]
unit Main;
interface
uses
Classes, Controls, Dialogs, Forms, Graphics, Messages, SysUtils, Windows,
Buttons, ComCtrls, Menus, ShellApi, StdCtrls;
type
TwndIconic = class (TForm)
PopupMenu1: TPopupMenu;
miClose: TMenuItem;
N1: TMenuItem;
miProperties: TMenuItem;
HotKey1: THotKey;
HotKey2: THotKey;
HotKey3: THotKey;
HotKey4: THotKey;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure miCloseClick(Sender: TObject);
procedure miPropertiesClick(Sender: TObject);
private
FTrayMessage: Cardinal;
procedure RButtonUp;
procedure LButtonDblClk;
protected
procedure WndProc(var Msg: TMessage); override;
public
procedure NotifyTray(Command: Word; const Hint: String);
end;
var
wndIconic: TwndIconic;
implementation
uses About;
{$R *.DFM}
resourcestring
STrayMessage = 'Mad.Dog.Marteens';
procedure TwndIconic.NotifyTray(Command: Word; const Hint: String);
var
Data: TNotifyIconData;
begin
Data.cbSize := SizeOf(Data);
Data.uID := 0;
Data.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
Data.Wnd := Self.Handle;
Data.uCallbackMessage := FTrayMessage;
Data.hIcon := Application.Icon.Handle;
StrLCopy(Data.szTip, PChar(Hint), SizeOf(Data.szTip)); Shell_NotifyIcon(Command, @Data);
end;
procedure TwndIconic.WndProc(var Msg: TMessage);
begin
if Msg.Msg = FTrayMessage then
case Msg.LParam of
WM_RBUTTONUP: RButtonUp;
WM_LBUTTONDBLCLK: LButtonDblClk;
end
else
inherited WndProc(Msg);
end;
procedure TwndIconic.LButtonDblClk;
begin
wndiconic.Create(self);
wndiconic.show;
end;
procedure TwndIconic.RButtonUp;
var
Pt: TPoint;
begin
GetCursorPos(Pt);
SetForegroundWindow(Application.Handle);
Application.ProcessMessages;
PopupMenu1.Popup(Pt.X, Pt.Y);
end;
procedure TwndIconic.FormCreate(Sender: TObject);
begin
Application.ShowMainForm := False;
ShowWindow(Application.Handle, SW_HIDE);
FTrayMessage := RegisterWindowMessage(PChar(STrayMessage));
NotifyTray(NIM_ADD, Application.Title);
end;
procedure TwndIconic.FormDestroy(Sender: TObject);
begin
NotifyTray(NIM_DELETE, '');
end;
procedure TwndIconic.miCloseClick(Sender: TObject);
begin
Close;
end;
procedure TwndIconic.miPropertiesClick(Sender: TObject);
begin
wndiconic.Show;
end;
end.
Saludos