Another example of using the Web Browser control

.

Hello from Greece.

My Browser.zip is showing an easy way to create a web browser. It uses Microsoft's ActiveX control for that purpose. There is already an example in the site, but i think mine is easier. That's because i use the Wizard to create the CWebBrowser class. As you see all we need to do is:

0. Add the Web Browser ActiveX control to the project. The AppWizard creates the CWebBrowser class for us.

1. We must create an instance of a CWebBrowser when OnCreate() Event occurs in our View class.

2. Use the OnSize() Event to size our control so that it covers the whole application's window.

3. Add some navigation buttons to the toolbar, with the appropriate handlers.

The job is very easy done because the AppWizard is creating the CWebBrowser class for us.

ATTENTION: The example code loads the a.htm, which must be at the same folder as the program.

The example code cannot be executed from the VC environment because it receives a wrong directory when, it calls the GetCurrentDir(), inside OnCreate() function and it cannot load the a.htm page.

Bye from Greece - Panagiotis.

Download Sample (59 kb)

Article added on June 21 1998



Comments

  • How to implement search functionality in given example.

    Posted by Uday on 03/19/2014 10:26pm

    I am Looking for search functionality in browser control, when i type a keyword and click on search it should highlight the matching words in browser displayed content.

    Reply
  • New one

    Posted by snareenactina on 12/10/2012 09:00pm

    What would you like to search for? misinterpret We need to educate America. apostolic cereno appignanesi playwriting beveragei

    Reply
  • good

    Posted by chenghaiquan on 03/30/2009 10:50pm

    That's just what I needed. But it's a little simple!

    Reply
  • Load HTML from Resources

    Posted by Legacy on 11/11/2003 12:00am

    Originally posted by: Nikitin_aka_KRoL

    How i can load html pages from resources?
    Using CWebBrowser;

    Reply
  • Modify HTML data itself?

    Posted by Legacy on 08/21/2002 12:00am

    Originally posted by: Todd Rhodes

    I enjoyed learning from this; Thanks. If one wanted to make systematic translations to any browsed HTML files (i.e. colors, fonts, etc.) in real time prior to displaying them, what would be the easiest way to incorporate this? Is there an HTML class that has this built in, or would I have to build some sort of filter/mangler to operate on the HTML prior to displaying it?

    Reply
  • IP address option

    Posted by Legacy on 02/06/2002 12:00am

    Originally posted by: alan

    I was wanting to stick an IPAddress control on the url dialog and insert an IP instead of a URL.

    Not sure how to do this as Navigate() only takes URL.

    And CIPAddressCtrl::GetAddress() returns a dword.

    any ideas?

    Reply
  • Copy&Paste problem

    Posted by Legacy on 07/30/2001 12:00am

    Originally posted by: Uwe

    Hi the Example is a great work. But copy & paste doesn't works. Ctrl-C / Ctrl-V and the the Exec()-Method whit the OLECMDID_COPY Prop doesn't works.

    Any Idea ?


    regards

    Uwe

    Reply
  • Need the Guru's comment!

    Posted by Legacy on 06/13/2001 12:00am

    Originally posted by: Yasuhiko Yoshimura

    Hi,
    This article is very great and useful.

    But I would like to get a working knowledge of IE5.5 hosting method for my active-x control.
    My active-x control is a DLL that manages document files ,prints them and previews them.
    I would plan to make IE5.5 control my active-x control like the Acrobat Reader4.0 that does show PDF documents delivered from any web site.

    I hope good ideas.

    Thanks,
    Yasuhiko Yoshimura

    Reply
  • How to intercept the contents of Homepage before showing in the IE browser without proxy?

    Posted by Legacy on 02/20/2001 12:00am

    Originally posted by: Yung-Ming Kuo

    Dear friends:

    I want to intercept and get the contents(including text and image) of homepage from Web server ,before it shows the IE browser(version 5.0).But it is not through proxy.

    And i have ability to prevent HTML document from showing the browser.

    Could you offer some suggestion or source code sample to solve my question?

    Thank you ^_^

    email:ymkuo@neural.ee.ncku.edu.tw

    by Kuo

    Reply
  • Very good work,

    Posted by Legacy on 11/13/2000 12:00am

    Originally posted by: ArunJose

    very nice work I was able to do the same with a dialog too.Thank u.
    (Arun)

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

  • "Security" is the number one issue holding business leaders back from the cloud. But does the reality match the perception? Keeping data close to home, on premises, makes business and IT leaders feel inherently more secure. But the truth is, cloud solutions can offer companies real, tangible security advantages. Before you assume that on-site is the only way to keep data safe, it's worth taking a comprehensive approach to evaluating risks. Doing so can lead to big benefits.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds