«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

Find the taskbar and system tray window handles

   

The task bar is a top level window which has class name "Shell_TrayWnd". We can find it using the Windows FindWindow API function as follows:

function TaskbarHandle: THandle;
begin
  Result := FindWindow('Shell_TrayWnd', nil);
end;

The system tray is a child window of the task bar which has class name "TrayNotifyWnd". Because it's a child window, we need to use the FindWindowEx Windows API function, passing the task bar's handle as the parent:

function TrayHandle: THandle;
begin
  Result := FindWindowEx(TaskbarHandle, 0, 'TrayNotifyWnd', nil);
end;
Author: Peter Johnson
Contributor: Peter Johnson
Added: 2007-08-14
Last updated: 2013-10-12

« Return to contents »