⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 internetexview.cpp

📁 这个程序主要是利用MFC编译的一个可以定制浏览器窗口的程序
💻 CPP
字号:
// InternetExView.cpp : implementation of the CInternetExView class
//

#include "stdafx.h"
#include "InternetEx.h"

#include "InternetExDoc.h"
#include "InternetExView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CInternetExView

IMPLEMENT_DYNCREATE(CInternetExView, CScrollView)

BEGIN_MESSAGE_MAP(CInternetExView, CScrollView)
	//{{AFX_MSG_MAP(CInternetExView)
		// 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, CScrollView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInternetExView construction/destruction

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

}

CInternetExView::~CInternetExView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CInternetExView drawing

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

void CInternetExView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	// TODO: This code navigates to a popular spot on the web.
	//  change the code to go where you'd like.
	//Get Current Path of exe
	CRect rc;
	GetClientRect(&rc);
	m_Browser.Create(NULL, WS_CHILD|WS_VISIBLE, rc, this, IDC_MY_EXPLORER);	
	Navigate();
}

void CInternetExView::Navigate()
{
	CString cszFullFileName;
	GetModuleFileName ( AfxGetInstanceHandle ( ), cszFullFileName.GetBuffer( MAX_PATH ), MAX_PATH ) ;
	cszFullFileName.ReleaseBuffer();
	cszFullFileName = cszFullFileName.Left ( cszFullFileName.ReverseFind ( '\\' ) ) ;


	COleVariant varEmpty;
	COleVariant varURL(cszFullFileName + "\\Test.html");

	m_Browser.Navigate2(varURL, varEmpty,varEmpty,varEmpty,varEmpty);
}
/////////////////////////////////////////////////////////////////////////////
// CInternetExView printing


/////////////////////////////////////////////////////////////////////////////
// CInternetExView diagnostics

#ifdef _DEBUG
void CInternetExView::AssertValid() const
{
	CScrollView::AssertValid();
}

void CInternetExView::Dump(CDumpContext& dc) const
{
	CScrollView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CInternetExView message handlers

void CInternetExView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
	// TODO: Add your specialized code here and/or call the base class
	
#ifndef _DEBUG
	CScrollView::OnPrepareDC(pDC, pInfo);  
#endif //_DEBUG
}

⌨️ 快捷键说明

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