Solved

About IWebBrowser2 object

Posted on 2002-06-20
4
602 Views
Last Modified: 2013-11-20
Hi.
I would like to access the content the IWebBrowser2
navigate. But I'm not familiar with this object. Can
somebody tell me how to do that or where can I find the
sample codes?
0
Comment
Question by:tan
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7097811
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7101488
What kinds of access do you need?  What is your ultimate goal?

-- Dan
0
 

Author Comment

by:tan
ID: 7101546
I use IWebBrowser2 object in my application and I want to
add some features to my application, such as highlight,
translation (from English to Chinese), etc. I'm not
familiar with this object. So I would like to know how to
access the content the object navigate?
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 100 total points
ID: 7102174
There is a DOM (Document Object Model) that lets you access any part of the page.  A good starting point for learning this is by playing around in JavaScript.  Bring up MDSN help on DHTML and write small scripts to access things such as body.bgcolor and so forth.  

Why would I suggest using JScript?  Because C++ makes it very difficult to use COM objects.  Bizarre error occur; text data is in BSTR format an VARIANT data types so each little thing you need to do takes many complex steps in C++.  With JScript it is a snap.  And the objects, methods and attributes are all the same -- so anything you learn can be translated into useful C++ knowledge.

>>I'm not familiar with this object.
The documentation in MDSN is usually geared toward accessing the object via VB or JScript.  However, there are many examples of C++ access, starting here:

Driller (MFC Sample):
http://search.microsoft.com/gomsuri.asp?n=3&c=rp_Results&siteid=us/dev&target=http://msdn.microsoft.com/Downloads/samples/Internet/browser/driller/Default.asp

Access the DOM using an HTA and JScript:
http://msdn.microsoft.com/downloads/samples/internet/browser/simplehta/default.asp

WalkAll accesses the DOM to look at each element:
http://msdn.microsoft.com/downloads/samples/internet/browser/walkall/default.asp

Lots of background info starting here:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/prog_browser_node_entry.asp?frame=true

-- Dan
0

Featured Post

Technology Partners: 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

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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