Как прочитать выделенный текст из IE?
Falk0ner, вс, 06/07/2008 - 15:35.
uses
SHDocVw_TLB; // <a href="http://www.euromind.com/iedelphi" title="http://www.euromind.com/iedelphi">http://www.euromind.com/iedelphi</a> 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;
SHDocVw_TLB; // <a href="http://www.euromind.com/iedelphi" title="http://www.euromind.com/iedelphi">http://www.euromind.com/iedelphi</a> 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;
Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php
Отправить комментарий