MFC 打开word、ppt、pdf文件方法
本文主要是通过网络学习以及自己编写的程序实现对word、ppt、pdf文件进行预览:
- 我的工程创建是mfc基于对话框的工程。
首先说下pdf文件的打开吧,通过插入ActiveX控件,选择“Adobe PDF Reader”,如下图所示
然后再通过“类向导”,选择“Adobe PDF Reader<1.01>”,前提是必须按照了Adober PDF Reader阅读器。点击完成。
在工程中定义 CAcroAXDocShim m_ViewPDF; 然后在DoDataExchange()函数中添加如下:
void Ctest_openfile_160119Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TESTOPENFILE_PDF, m_ViewPDF);//添加
}