?
Solved

Get Document for a specified IE

Posted on 2003-02-28
5
Medium Priority
?
153 Views
Last Modified: 2010-04-04
I wish to get the Document for a specified IE browser.

Something alike MyIE.Document.....
0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:loop_until
ID: 8046630
To have inner text you might want to use something like:

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
var
  Frame, Bod: Variant;
begin
  // To get inner text
  Frame := IWebBrowser(pDisp).Document;
  Bod := Frame.Body;
  Memo1.Text := Bod.InnerText;
end;


Does it helps?
Have a nice day! :-)
0
 
LVL 3

Accepted Solution

by:
loop_until earned 300 total points
ID: 8046662
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8047423
I wish to get from IE and not WebBrowser.
0
 
LVL 9

Author Comment

by:ginsonic
ID: 8047429
From

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20531867.html

I try to replace the getHTML with something alike getSnap with next:

var  ViewObject: IViewObject;
 sourceDrawRect: TRect;

...

if WB.Document <> nil then
   try
      WB.Document.QueryInterface(IViewObject, ViewObject);
      if ViewObject <> nil then
      try
         sourceDrawRect := Rect(0, 0, WB.Width, Wb.Height);
         ViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil, Self.Handle,
         image1.Canvas.Handle, @sourceDrawRect, nil, nil, 0);
      finally
         ViewObject._Release;
      end;
      Image1.Canvas.Refresh;
   except
   end;

But can't success :(
0
 
LVL 3

Expert Comment

by:loop_until
ID: 8089803
This is for HTML source:

var
  HTMLDocument: IHTMLDocument2;
  PersistFile: IPersistFile;
begin
  ...
  HTMLDocument := WebBrowser1.Document as IHTMLDocument2;
  PersistFile := HTMLDocument as IPersistFile;
  PersistFile.Save(StringToOleStr('test.htm'), True);

  while HTMLDocument.readyState <> 'complete' do
    Application.ProcessMessages;
     ...
end;


Better?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question