SHARE
Facebook X Pinterest WhatsApp

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 […]

Written By
thumbnail
CodeGuru Staff
CodeGuru Staff
Aug 7, 1998
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

.

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

Recommended for you...

Configuring Security Rules In Azure Firewall
Tapas Pal
May 7, 2022
Implementing Circuit Breaker Using Polly
Tapas Pal
Jan 26, 2022
Cloud Computing Types Overview
Zaher Talab
Oct 7, 2021
“Some Day”: 1984: An Editorial on the Future of Computers
Bradley L. Jones
Aug 24, 2021
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.