Z
Zhaohui Xing
My PPT automation application calls CPresentations::Open() to open the source PPT file, the code work fine under PPT2003 and PPT2000 (Call OpenOld())
But alway failed in PPT2002 and during debuging, the error code in the exception is unknown. wried. Even I used progID "PowerPoint.Application.10", It always donot work.
Thanks
XZh
The sampel code is:
OleInitialize(NULL);
CApplication pptApp;
CLSID clsid;
if(FAILED(CLSIDFromProgID(OLESTR("PowerPoint.Application"), &clsid)))
{
return nRetCode;
}
if(!pptApp.CreateDispatch(clsid))
// if(!pptApp.CreateDispatch(_T("PowerPoint.Application.10")))
// if(!pptApp.CreateDispatch(_T("PowerPoint.Application"), 0))
{
TRACE(_T("Couldn't start PowerPoint and get Application object."));
return nRetCode;
}
pptApp.put_Visible(TRUE);
CPresentations pptPresentations = pptApp.get_Presentations() ;
// open a presentation
CPresentation pptPresentation = pptPresentations.Open(_T("c:\\dev\\outline.ppt"), FALSE, TRUE, TRUE);
OleUninitialize();
But alway failed in PPT2002 and during debuging, the error code in the exception is unknown. wried. Even I used progID "PowerPoint.Application.10", It always donot work.
Thanks
XZh
The sampel code is:
OleInitialize(NULL);
CApplication pptApp;
CLSID clsid;
if(FAILED(CLSIDFromProgID(OLESTR("PowerPoint.Application"), &clsid)))
{
return nRetCode;
}
if(!pptApp.CreateDispatch(clsid))
// if(!pptApp.CreateDispatch(_T("PowerPoint.Application.10")))
// if(!pptApp.CreateDispatch(_T("PowerPoint.Application"), 0))
{
TRACE(_T("Couldn't start PowerPoint and get Application object."));
return nRetCode;
}
pptApp.put_Visible(TRUE);
CPresentations pptPresentations = pptApp.get_Presentations() ;
// open a presentation
CPresentation pptPresentation = pptPresentations.Open(_T("c:\\dev\\outline.ppt"), FALSE, TRUE, TRUE);
OleUninitialize();