Solved

About IWebBrowser2 object

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

789 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