1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| function TForm1.SucheFensterUeberTitel(FensterTitel: string): Hwnd; var NextHandle: Hwnd; NextTitle: array[0..260] of char; begin NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST); while NextHandle > 0 do begin GetWindowText(NextHandle, NextTitle, 255); if Pos(FensterTitel, StrPas(NextTitle)) <> 0 then begin Result := NextHandle; Exit; end else NextHandle := GetWindow(NextHandle, GW_HWNDNEXT); end; Result := 0; end;
procedure TForm1.Button1Click(Sender: TObject); begin if SucheFensterUeberTitel('Arbeitsplatz') <> 0 then Showmessage('Arbeitsplatz offen'); end; |