我给一个可以在DOS下执行的版本,刚刚写出来的,保证你测试通过:<br><br>program a;<br>{$apptype console}<br>uses windows,sysutils;<br>var<br> hCurrentWindow: HWnd;<br> szText: array[0..254] of char;<br>begin<br> hCurrentWindow := GetWindow(GetTopWindow(GetDeskTopWindow), GW_HWNDFIRST);<br> while hCurrentWindow <> 0 do<br> begin<br> if iswindowvisible(hCurrentWindow) then<br> begin<br> if GetWindowText(hCurrentWindow, @szText, 255)>0 then<br> writeln(StrPas(@szText));<br> end; <br> hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);<br> end;<br>end.<br>