PPT2007 crashes when calling Save() API in OnPresentationClose event

H

HemiltonChen

Hi All,

I built a COM Add-in for PPT2007 using ATL, which only includes Save()
API in OnPresentationClose event.
Here is the code snippet:

void __stdcall CAddin::OnPresentationClose(IDispatch * /*Document**/
ptr)
{
CComQIPtr<MSPowerpoint::_Presentation> spDoc(ptr);
ATLASSERT(spDoc);
if(NULL == spDoc.p)
return;
HRESULT hr = spDoc->Save();
ATLASSERT(SUCCEEDED(hr));
}

When I open an existing pptx file and make some changes via mouse
input(such as Insert->Table), and then close the PPT application
directy via upper right 'X' button, the OnPresentationClose() event is
hit and it's ok to call Save(), but after that, I press F5, the PPT
crashes.
Did anyone enconter this issue? is it a PPT 2007 bug? it's ok for
PPT2003/XP using the same simple code. any wordarounds?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top