Author: Tomas Rutkauskas
I need to show some information to the user when the mouse moves over the icon in
the tray sector. I am using the Shell_NotifyIcon funtion with NIM_ADD, NIM_DELETE
parameters to show or not show the icon. How to show that hint?
Answer:
It is automatic, you only need to tell Shell_NotifyIcon which hint to use.
1 {Update the tray icons tooltip}2 3 procedure UpdateTrayTip;
4 var5 nim: TNotifyIconData;
6 begin7 FillChar(nim, sizeof(nim), 0);
8 nim.cbSize := Sizeof(nim);
9 nim.Wnd := wnd;
10 nim.uID := ICONID;
11 nim.uFlags := NIF_TIP;
12 StrLCopy(nim.szTip, GetTrayTooltip, Sizeof(nim.szTip) - 1);
13 Shell_NotifyIcon(NIM_MODIFY, @nim);
14 end;
GetTrayTooltip is a function that in my case returns a PChar pointing at an entry in a constant array of Pchars. You can use StrPLCopy if you have a String holding the tooltip instead. You can set the tip on NIM_ADD as well.