p; AfxMessageBox("Couldn''t start Powerpoint.");
}
else
{
// Make Powerpoint Visible and display a message
app.SetVisible(TRUE);
TRACE("Powerpoint is Running!");
}
}
(7) 在硬盘中打开一个展示,在Open按钮函数呼叫中添加代码:
void CPowerPntDlg::OnBtnOpen()
{
static char BASED_CODE szFilter = "Powerpoint Files (*.ppt)|*.ppt||";
CFileDialog FileDlg(TRUE,"PPT",NULL,OFN_FILEMUSTEXIST|OFN_NONETWORKBUTTON|OFN_PATHMUSTEXIST,szFilter);
FileDlg.DoModal();
// To get the selected file''s path and name
CString strFileName;
strFileName = FileDlg.GetPathName();
if(!strFileName.IsEmpty())
{
Presentations = app.GetPresentations();
Presentation = Presentations.Open(strFileName,0,0,1);
}
}
(8)