Bei mir nicht. Streng dich bitte etwas mehr an - immerhin musst du bald meine Rente finanzieren.
Delphi-Quellcode:
uses
MSHTML,
ActiveX,
ShlObj;
function SelectedText(doc: IHTMLDocument2):
String;
begin
with doc.selection.createRange
as IHTMLTxtRange
do
Result := text;
end;
function InternetExplorer: IWebBrowser2;
var
sw: IShellWindows;
i: Integer;
disp: IDispatch;
begin
sw := CoShellWindows.Create;
for i := 0
to Pred(sw.Count)
do
begin
disp := sw.Item(i);
if Succeeded(disp.QueryInterface(IID_IWebBrowser2, Result))
then
Exit;
end;
Result :=
nil;
end;
procedure TDemoForm.ButtonClick(Sender: TObject);
var
wb2: IWebBrowser2;
begin
wb2 := InternetExplorer;
if Assigned(wb2)
then
ShowMessage(SelectedText(wb2.Document
as IHTMLDocument2));
end;
Freundliche Grüße vom marabu