webbrowseview.cpp

来自「学习VC的一些例子」· C++ 代码 · 共 104 行

CPP
104
字号
// WebBrowseView.cpp : implementation of the CWebBrowseView class
//

#include "stdafx.h"
#include "WebBrowse.h"

#include "MainFrm.h"

#include "WebBrowseDoc.h"
#include "WebBrowseView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView

IMPLEMENT_DYNCREATE(CWebBrowseView, CHtmlView)

BEGIN_MESSAGE_MAP(CWebBrowseView, CHtmlView)
	//{{AFX_MSG_MAP(CWebBrowseView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView construction/destruction

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

}

CWebBrowseView::~CWebBrowseView()
{
}

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

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView drawing

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

void CWebBrowseView::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);
}

/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView printing


/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CWebBrowseView message handlers

void CWebBrowseView::OnDocumentComplete(LPCTSTR lpszURL)
{
	((CMainFrame *) GetParentFrame())->SetAddress(lpszURL);		
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?