2007. december 4., kedd

How to get a list of the applications that will appear on the Windows Taskbar


Problem/Question/Abstract:

I am trying to get a list of the windows that will appear on the Taskbar (and perhaps on Alt-Tab). I have tried to find the ones with no parent windows, etc. but I cannot find the pattern.

Answer:

As far as I know it has never been explicitly documented which criteria Windows uses here. Try the following:

function EnumWindowsProc(Wnd: HWND; LParam: LPARAM): BOOL; stdcall;
begin
  Result := True;
  if (IsWindowVisible(Wnd) or IsIconic(wnd)) and
    ((GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) or
    (GetWindowLong(Wnd, GWL_HWNDPARENT) = GetDesktopWindow)) and
    { skip WS_EX_TOOLWINDOW windows }
  (GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0) then
  begin
    { place code here }
  end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése