Hi, ich verwende den folgenden Code...
Delphi-Quellcode:
function EnumChildProc(Wnd : hWnd; SL : TStrings) : Boolean; StdCall;
var
szFull : Array[0..MAX_PATH] of char; //Buffer for window caption
begin
Result:=Wnd<>0;
if Result then begin
GetWindowText(Wnd, szFull, SizeOf(szFull)); // put window text in buffer
if (pos(SL[0],StrPas(szFull))>0) // Test for text
and (SL.IndexOfObject(TOBject(Wnd))< 0) // Test for duplicate handles
then SL.AddObject(StrPas(szFull),TObject(Wnd)); // Add item to list
EnumChildWindows(Wnd,@EnumChildProc, LongInt(SL)); //Recurse into child windows
end;
end;
function EWindowsCode(Wnd: hWnd; lParam: LPARAM): Boolean; Export; StdCall;
var
Buffer : Array[0..99] of char;
hn : HWnd;
begin
GetWindowText(Wnd, Buffer, 100);
if(StrLen(Buffer) <> 0) then
begin
SearchListview1(StrPas(Buffer));
SearchListview2(StrPas(Buffer));
end;
Result:= True;
end;
Aufgerufen wird der code durch
EnumWindows(@EWindowsCode, LongInt(Self))
in einem Timer
Gruss
Scorpion
[Edit=Christian Seehase]Delphi Tags hinzugefügt[/Edit]