Alle Fensterhandle finden anhand der WindowCaption
Hallo !!
Manchmal kommt es vor, dass man Handle mehrerer Fenster braucht, die jedoch alle die selbe WindowCaption haben. Hierzu hab ich folgende Funktion mit der Hilfe von neolithos (der Thread) geschrieben
Delphi-Quellcode:
type THandleArray = array of HWND;
function FindAllWindows(const WindowCaption: String): THandleArray; type PParam = ^TParam; TParam = record WindowCaption: String; Res: THandleArray; end; var Rec: TParam; function _EnumProc(_hWnd: HWND; _LParam: LPARAM): LongBool; stdcall; var cTitle: array[0..1023] of Char; begin with PParam(_LParam)^ do begin GetWindowText(_hWnd, cTitle, SizeOf(cTitle)); if (CompareText(cTitle, WindowCaption) = 0) then begin SetLength(Res, Length(Res)+1); Res[Length(Res)-1] := _hWnd; end; Result := True; end; end; begin Rec.WindowCaption := WindowCaption; SetLength(Rec.Res, 0); EnumWindows(@_EnumProc, Integer(@Rec)); Result := Rec.Res; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz