Beranda > Delphi > Find the taskbar and system tray window handles

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;
You can find both these routines in the Code Snippets Database.
Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: