exporttohtmlview.cpp

来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 91 行

CPP
91
字号
// ExportToHtmlView.cpp : implementation file
//

#include "stdafx.h"
#include "community.h"
#include "ExportToHtmlView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExportToHtmlView

IMPLEMENT_DYNCREATE(CExportToHtmlView, CFormView)

CExportToHtmlView::CExportToHtmlView()
	: CFormView(CExportToHtmlView::IDD)
{
	i_pHtmlView = NULL ;
	//{{AFX_DATA_INIT(CExportToHtmlView)
	m_strTemFileName = _T("");
	m_strDestPath = _T("");
	//}}AFX_DATA_INIT
}

CExportToHtmlView::~CExportToHtmlView()
{
}

void CExportToHtmlView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CExportToHtmlView)
	DDX_Text(pDX, IDC_TEM_FILE, m_strTemFileName);
	DDX_Text(pDX, IDC_DEST_PATH, m_strDestPath);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CExportToHtmlView, CFormView)
	//{{AFX_MSG_MAP(CExportToHtmlView)
	ON_BN_CLICKED(IDC_EXPORT, OnExport)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CExportToHtmlView diagnostics

#ifdef _DEBUG
void CExportToHtmlView::AssertValid() const
{
	CFormView::AssertValid();
}

void CExportToHtmlView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CExportToHtmlView message handlers

void CExportToHtmlView::OnExport() 
{
	CArticleDoc * pDoc = (CArticleDoc*) m_pDocument ;
	if(NULL == pDoc)
	{
		ASSERT(false);
		return ;
	}
	
	UpdateData();
	CString strMess ;
	if(!pDoc->m_mainData.ExportFiles(m_strTemFileName,m_strDestPath,strMess))
	{
		AfxMessageBox(strMess);
		return ;
	}

	if( NULL != i_pHtmlView)
	{
		CString strUrl = m_strDestPath + "index.htm" ;
		//CString strUrl = "about:blank " ;
		i_pHtmlView->Navigate((LPCTSTR)strUrl) ;
	}
}

⌨️ 快捷键说明

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