<br>function GetText(Wnd : HWND) : string;<br>var<br> textlength : integer;<br> text : String;<br>begin<br> textlength:=SendMessage(Wnd,WM_GETTEXTLENGTH,0,0);<br> if textlength=0 then<br> Result := ''<br> else begin<br> SetLength(text, textlength+1) ;<br> SendMessage(Wnd,WM_GETTEXT,textlength+1,PChar(text));<br> Result:=text;<br> end;<br>end;<br><br>function EnumWindowsProc (Wnd: HWND; LParam: LPARAM): BOOL; stdcall;<br>var<br> s : String ;<br>begin<br> Result := True;<br> if (IsWindowVisible(Wnd)) and (GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) and (GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0) then begin<br> s := ''+Inttostr(Wnd)+', '+ GetText(Wnd) ;<br> Form1.Listbox1.items.add(s);<br> end;<br>end; <br><br>procedure TForm1.BtnRefreshClick(Sender: TObject);<br>var<br> Param : Longint;<br>begin<br> Param := 0 ;<br> EnumWindows(@EnumWindowsProc , Param);<br>end;<br>