![]() |
FensterHandle ohne vollständigen Titel
Hi
ich habe es bisher so gelöst:
Delphi-Quellcode:
nun ist aber das problem (oder das ungünstige) das man hierfür den 100% korrekten titel angeben muss.
procedure TForm_Settings.CLBHide;
//Programme Verstecken //Edit: CLB_Hide is ne CheckListBox wo die Titel drinstehen var i:Integer; ST: Integer; begin for i:=0 to CLB_Hide.Count-1 do begin if CLB_Hide.Checked[i] then ST:=SW_HIDE else ST:=SW_SHOWNA; //Show or Hide? ShowWindow(FindWindow(nil,PAnsiChar(CLB_Hide.Items[i])),ST); end; end; kann man irgendwie nur nach fenstern suchen wo ein string drin vorkommt? oder kann man das Handle anhand der Exe rausfinden? |
Re: FensterHandle ohne vollständigen Titel
Ein Programm hat nicht DAS HANDLE. Ein Programm kann mehrere Handles haben (zumindest wenn man von Fensterhandles spricht, und das tust du ja hier).
|
Re: FensterHandle ohne vollständigen Titel
|
Re: FensterHandle ohne vollständigen Titel
Zitat:
Delphi-Quellcode:
function FindWindowByTitle(WindowTitle: string): Hwnd;
var NextHandle: Hwnd; NextTitle: array[0..255] of char; begin // Get the first window NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST); while NextHandle > 0 do begin // retrieve its text GetWindowText(NextHandle, NextTitle, 255); if Pos(WindowTitle, StrPas(NextTitle)) <> 0 then begin Result := NextHandle; Exit; end else // Get the next window NextHandle := GetWindow(NextHandle, GW_HWNDNEXT); end; Result := 0; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:07 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz