获取TrayHint的句柄
function GetTrayTooltipHandle: HWND;
{ All tray icons (but not the clock) share the same tooltip.
Return the tooltip handle or 0 if error. }
var
wnd, lTaskBar: HWND;
pidTaskBar, pidWnd: DWORD;
begin
// Get the TaskBar handle
lTaskBar := FindWindowEx(0, 0, 'Shell_TrayWnd', nil);
// Get the TaskBar Process ID
GetWindowThreadProcessId(lTaskBar, @pidTaskBar);
// Enumerate all tooltip windows
wnd := FindWindowEx(0, 0, TOOLTIPS_CLASS, nil);
while wnd <> 0 do
begin
// Get the tooltip process ID
GetWindowThreadProcessId(wnd, @pidWnd);
{ Compare the process ID of the taskbar and the tooltip.
If they are the same we have one of the taskbar tooltips. }
if pidTaskBar = pidWnd then
{ Get the tooltip style. The tooltip for tray icons does not have t he
TTS_NOPREFIX style. }
if (GetWindowLong(wnd, GWL_STYLE) and TTS_NOPREFIX) = 0 then
Break;
wnd := FindWindowEx(0, wnd, TOOLTIPS_CLASS, nil);
end;
Result := wnd;
end;