H
Hemilton Chen
Hi,
We encounter the following problem with either Office applications or APIs.
Please advise us if it is product defect and if there is any alternative or
workaround to achieve what we are trying to do. Thanks.
Description:
PowerPoint 2007 will crash during exit if we do an API save in
OnPresentationClose event. Crash happens when:
1. File is dirty
2. The change is of certain kind (see one example below)
3. PowerPoint 2007 is closed via “X†button at top right corner
We need to save document programmatically and send the file to another
location.
Brief steps to re-produce:
1, Create a Powerpoint 2007 COM Add-in using ATL with Ribbon
UI(I am trying to upload a test app, but i can't find any approaches in this
newsgroups site)
2, Hook the OnPresentationClose event and add the following
codes in it.(see the code snippet at the end of this posting)
3, Register the COM dll via regsvr32 command and make sure it's
registered successfully.
4, Start PowerPoint 2007 and insert a table using mouse
5. Close PowerPoint 2007 via “X†button
Result: PowerPoint 2007 crashes
/**
* Event sink from Powerpoint, before a document is closed
*/
void __stdcall CAddin::OnPresentationClose(IDispatch * /*Document**/ ptr)
{
HRESULT hr = S_OK;
CComQIPtr<MSPowerpoint::_Presentation> spDoc(ptr);
ATLASSERT(spDoc);
if(NULL == spDoc.p)
return;
if(msoFalse == spDoc->GetSaved())
{
hr = spDoc->Save();
ATLASSERT(SUCCEEDED(hr));
}
}
We encounter the following problem with either Office applications or APIs.
Please advise us if it is product defect and if there is any alternative or
workaround to achieve what we are trying to do. Thanks.
Description:
PowerPoint 2007 will crash during exit if we do an API save in
OnPresentationClose event. Crash happens when:
1. File is dirty
2. The change is of certain kind (see one example below)
3. PowerPoint 2007 is closed via “X†button at top right corner
We need to save document programmatically and send the file to another
location.
Brief steps to re-produce:
1, Create a Powerpoint 2007 COM Add-in using ATL with Ribbon
UI(I am trying to upload a test app, but i can't find any approaches in this
newsgroups site)
2, Hook the OnPresentationClose event and add the following
codes in it.(see the code snippet at the end of this posting)
3, Register the COM dll via regsvr32 command and make sure it's
registered successfully.
4, Start PowerPoint 2007 and insert a table using mouse
5. Close PowerPoint 2007 via “X†button
Result: PowerPoint 2007 crashes
/**
* Event sink from Powerpoint, before a document is closed
*/
void __stdcall CAddin::OnPresentationClose(IDispatch * /*Document**/ ptr)
{
HRESULT hr = S_OK;
CComQIPtr<MSPowerpoint::_Presentation> spDoc(ptr);
ATLASSERT(spDoc);
if(NULL == spDoc.p)
return;
if(msoFalse == spDoc->GetSaved())
{
hr = spDoc->Save();
ATLASSERT(SUCCEEDED(hr));
}
}