Solved

About IWebBrowser2 object

Posted on 2002-06-20
4
596 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
mixString challenge 36 123
Add content to output file 4 63
x-bar in Google Sheets 2 55
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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. …
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 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