Mega Code Archive

 
Categories / Delphi / Forms
 

How to get the handle to the window that ownes the taskbar buttons (NT)

Title: How to get the handle to the window that ownes the taskbar buttons (NT) function TaskmanWindow: HWND; type TGetTaskmanWindow = function(): HWND; stdcall; var hUser32: THandle; GetTaskmanWindow: TGetTaskmanWindow; begin Result := 0; hUser32 := GetModuleHandle('user32.dll'); if (hUser32 0) then begin @GetTaskmanWindow := GetProcAddress(hUser32, 'GetTaskmanWindow'); if Assigned(GetTaskmanWindow) then begin Result := GetTaskmanWindow; end; end; end; procedure ShowTaskmanWindow(bValue: Boolean); var hTaskmanWindow: Hwnd; begin hTaskmanWindow := TaskmanWindow; if hTaskmanWindow 0 then begin ShowWindow(GetParent(hTaskmanWindow), Ord(bValue)); end; end; UsageExample to Hide the Taskman Window procedure TForm1.Button1Click(Sender: TObject); begin ShowTaskmanWindow(False); end;