There is a freeware set of Delphi Components call RX Library (available at SourceForge.net) that comes with complete source code.
In the array of components is a TrayIcon component..
In that class there is a couple of methods :
procedure TRxTrayIcon.Activate;and
procedure TRxTrayIcon.UpdateNotifyData;The conjunction of those two methods should contain the code that gets the job done