explorerview.cpp

来自「Visual_C++.NET实用编程百例」· C++ 代码 · 共 103 行

CPP
103
字号
// explorerView.cpp : CexplorerView 类的实现
//

#include "stdafx.h"
#include "explorer.h"

#include "explorerDoc.h"
#include "explorerView.h"
#include ".\explorerview.h"
#include "mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CexplorerView

IMPLEMENT_DYNCREATE(CexplorerView, CHtmlView)

BEGIN_MESSAGE_MAP(CexplorerView, CHtmlView)
	// 标准打印命令
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
END_MESSAGE_MAP()

// CexplorerView 构造/析构

CexplorerView::CexplorerView()
{
	// TODO: 在此处添加构造代码

}

CexplorerView::~CexplorerView()
{
}

BOOL CexplorerView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
	// 样式

	return CHtmlView::PreCreateWindow(cs);
}

void CexplorerView::OnInitialUpdate()
{
	CHtmlView::OnInitialUpdate();
	Navigate2(_T("http://localhost/"),NULL,NULL);
}


// CexplorerView 打印



// CexplorerView 诊断

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

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

CexplorerDoc* CexplorerView::GetDocument() const // 非调试版本是内联的
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CexplorerDoc)));
	return (CexplorerDoc*)m_pDocument;
}
#endif //_DEBUG


// CexplorerView 消息处理程序

 void CexplorerView::OnBnClickedButton4()
{
	// TODO: 在此添加控件通知处理程序代码
	CString str;
	str=((CMainFrame *)(AfxGetApp()->GetMainWnd()))->getURL();
	Navigate2(str,NULL,NULL);
}
void CexplorerView::OnBnClickedButton3()
{
	Stop();
}
void CexplorerView::OnBnClickedButton2()
{
	GoForward();
}
void CexplorerView::OnBnClickedButton1()
{
	GoBack();
}

⌨️ 快捷键说明

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