2005. július 30., szombat

Show a hint for an iconized application


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?


It is automatic, you only need to tell Shell_NotifyIcon which hint to use.

{Update the tray icons tooltip}

procedure UpdateTrayTip;
  nim: TNotifyIconData;
  FillChar(nim, sizeof(nim), 0);
  nim.cbSize := Sizeof(nim);
  nim.Wnd := wnd;
  nim.uID := ICONID;
  nim.uFlags := NIF_TIP;
  StrLCopy(nim.szTip, GetTrayTooltip, Sizeof(nim.szTip) - 1);
  Shell_NotifyIcon(NIM_MODIFY, @nim);

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.

Nincsenek megjegyzések:

Megjegyzés küldése