这个应该可以的: for i:=Screen.FormCount-1 downto 0 do ...
逐一查出各视窗的标题:procedure TForm1.Button1Click(Sender: TObject); var hCurrentWindow: HWnd; szText: array[0..254] of char; begin hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST); while hCurrentWindow <> 0 do begin if GetWindowText(hCurrentWindow, @szText, 255) > 0 then Memo1.Lines.Add(StrPas(@szText)); hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT); end; end;
for i:=Screen.FormCount-1 downto 0 do ...
var
hCurrentWindow: HWnd;
szText: array[0..254] of char;
begin
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
if GetWindowText(hCurrentWindow, @szText, 255) > 0 then
Memo1.Lines.Add(StrPas(@szText));
hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
end;