Delphi Sources

Получить выделенный текст из окна IE



Оформил: DeeCo

uses
   SHDocVw_TLB; // http://www.euromind.com/iedelphi if don't have that unit 

function GetSelectedIEtext: string;
 var
   x: Integer;
   Sw: IShellWindows;
   IE: HWND;
 begin
   IE := FindWindow('IEFrame', nil);
   sw := CoShellWindows.Create;
   for x := SW.Count - 1 downto 0 do
     if (Sw.Item(x) as IWebbrowser2).hwnd = IE then begin
       Result := variant(Sw.Item(x)).Document.Selection.createRange.Text;
       break;
     end;
 end;

Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте