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

  • 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
  • Works only on the computer on which this code is compiled ?

    Posted by Legacy on 09/12/2000 12:00am

    Originally posted by: Christophe Guibert

    I've compiled/linked this code in Windows 98 and it works fine. Thanks.

    But when I copy the EXE on another PC (with the same operating system and Visual C++ installation) :
    the program crashes on this new PC while initializing OLE.

    I've tried with various configurations (WinNT 4 and tried IE3 and IE4 CLSIDs) without success.

    Program would work only when compiled on the final target machine...

    Could anyone give help or advices on that subject, seemingly related with ActiveX ?

    Regards.

    CG

    Reply
  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • With JRebel, developers get to see their code changes immediately, fine-tune their code with incremental changes, debug, explore and deploy their code with ease (both locally and remotely), and ultimately spend more time coding instead of waiting for the dreaded application redeploy to finish. Every time a developer tests a code change it takes minutes to build and deploy the application. JRebel keeps the app server running at all times, so testing is instantaneous and interactive.

  • The latest release of SugarCRM's flagship product gives users new tools to build extraordinary customer relationships. Read an in-depth analysis of SugarCRM's enhanced ability to help companies execute their customer-facing initiatives from Ovum, a leading technology research firm.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds