Home | Overview | How Do I | Details | Sample
You can use the MFC AppWizard to create an application that displays any Web content you specify.
To create a Web browser application
Your application must be based on the MFC document/view architecture (default).
The CHtmlView class acts as a wrapper for the Web browser control, which gives your application a view onto a Web, or HTML page. The wizard creates an override to the OnInitialUpdate function in the view class, providing a navigational link to the Microsoft Visual C++ Web site:
void CWebView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
// TODO: This code navigates to a popular spot on the web.
// change the code to go where you'd like.
Navigate2(_T("http://www.microsoft.com/visualc/"),NULL,NULL);
}
You can replace this site with one of your own, or you can use the LoadFromResource function to open an HTML page that resides in the project's resource script as the default content for the view. For example:
void CWebView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
// TODO: This code navigates to a popular spot on the web.
// change the code to go where you'd like.
LoadFromResource(IDR_HTML1);
}
Open my HTML page as the default in my Web Browser application