API - capturando o handle do gerenciador de programas (shell) |
Top Previous Next |
function ShellWindow: HWND; type TGetShellWindow = function(): HWND; stdcall; var hUser32: THandle; GetShellWindow: TGetShellWindow; begin Result := 0; hUser32 := GetModuleHandle('user32.dll'); if (hUser32 > 0) then begin @GetShellWindow := GetProcAddress(hUser32, 'GetShellWindow'); if Assigned(GetShellWindow) then Result := GetShellWindow; end; end;
procedure TForm1.Button1Click(Sender: TObject); var hShellWindow: Hwnd; strWinText: array[0..260] of char; begin hShellWindow := ShellWindow; if hShellWindow <> 0 then begin GetWindowText(ShellWindow, strWinText, 255); ShowMessage(strWinText); end; end; |