www.gusucode.com > VC写的网页浏览器源码,功能不多源码程序 > VC写的网页浏览器源码,功能不多源码程序\code\E06View.cpp

    // E06View.cpp : implementation of the CE06View class
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "E06.h"

#include "E06Doc.h"
#include "E06View.h"
#include "AddressDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CE06View

IMPLEMENT_DYNCREATE(CE06View, CHtmlView)

BEGIN_MESSAGE_MAP(CE06View, CHtmlView)
	//{{AFX_MSG_MAP(CE06View)
	ON_COMMAND(ID_FILE_NAVIGATE, OnFileNavigate)
	ON_COMMAND(ID_FILE_BACK, OnFileBack)
	ON_COMMAND(ID_FILE_FORWARD, OnFileForward)
	ON_COMMAND(ID_FILE_HOME, OnFileHome)
	ON_COMMAND(ID_FILE_STOP, OnFileStop)
	ON_COMMAND(ID_FILE_REFRESH, OnFileRefresh)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CE06View construction/destruction

CE06View::CE06View()
{
	// TODO: add construction code here

}

CE06View::~CE06View()
{
}

BOOL CE06View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CE06View drawing

void CE06View::OnDraw(CDC* pDC)
{
	CE06Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

void CE06View::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("www.baidu.com"),NULL,NULL);
}

/////////////////////////////////////////////////////////////////////////////
// CE06View diagnostics

#ifdef _DEBUG
void CE06View::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CE06View::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CE06Doc* CE06View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CE06Doc)));
	return (CE06Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CE06View message handlers

void CE06View::OnFileNavigate() 
{
	// TODO: Add your command handler code here
 	CAddressDlg dlg;
 	if (dlg.DoModal()!=IDOK) return;
 
 	Navigate2(dlg.m_address);
}

void CE06View::OnFileBack() 
{
	// TODO: Add your command handler code here
	GoBack();
}

void CE06View::OnFileForward() 
{
	// TODO: Add your command handler code here
	GoForward();
}

void CE06View::OnFileHome() 
{
	// TODO: Add your command handler code here
	GoHome();
}

void CE06View::OnFileStop() 
{
	// TODO: Add your command handler code here
	Stop();
}

void CE06View::OnFileRefresh() 
{
	// TODO: Add your command handler code here
	Refresh();
}