FullName property

C

Calin

Hello

I builded a COM addin for PowerPoint which it is used to catch some events.
I have the following problem : during saving of an presentation (I have a
PresentationSave event handler) I'm opening a temporary, invisible
presentation and then close it immediatelly. Before opening the temporary
presentation, the FullName property returns a valid path (fully qualified)
for the current presentation. After I open/close the temporary presentation,
the FullName property returns something like "Presentation1". Somehow the
property value it is altered. Does anyone have any ideea how to deal with
this ? Is there any way to avoid this ?

Thanks, Calin
 
S

Shyam Pillai

The only time you see this is when the presentation has never been saved
before. When this happens the Path property will be blank. Are you sure you
are closing the correct presentation?


--
Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm
 
C

Calin

You're right. But, before I open the temporary presentation the FullName
property have a valid value. And yes, I'm sure, I close the correct
presentation, because I call close method on the presentation object
returned by Open method, so it should be ok.

Thanks, Calin
 
S

Shyam Pillai

If you are certain that there is nothing wrong with your implementation then
you will need to resolve this yourself or else post your code here like
Austin suggested and we can take a look.


--
Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
 
C

Calin

Thanks.
Unfortunatelly the code is written in C++ and it is difficult to post the
entire project here. But here is the PresentationSave (dispid 2005) event
handler :


STDMETHODIMP CPPTSink::OnPresentationSave(IDispatch *pPresentation)
{
OutputDebugString("OnPresentationSave\n");

CComQIPtr<_Presentation> ptrPresentation(pPresentation);
if(!ptrPresentation)
return E_POINTER;

// Get the FullName property value
CComBSTR bstrFullName = ptrPresentation->FullName.copy(); // here I get
the right value

_Application *pApplication = NULL;
try
{
// get the _Application interface pointer from GIT
HRESULT hr = m_pGIT->GetInterfaceFromGlobal(m_dwApplication,
__uuidof(_Application), (void**)&pApplication);
if(FAILED(hr) || NULL == pApplication)
return hr;

// Open temporary, invisible, presentation
CComPtr<_Presentation> ptrTempPresentation =
pApplication->Presentations->Open(_bstr_t(_T("c:\\test.ppt")), msoFalse,
msoFalse, msoTrue);
if(ptrTempPresentation)
{
// Get the FullName property value
bstrFullName = ptrPresentation->FullName.copy(); // here I still
get the right value

// Close temporary presentation
ptrTempPresentation->Close();
}

// Get the FullName property value
bstrFullName = ptrPresentation->FullName.copy(); // here I get a
wrong value like "Presentation1"

// Release _Application interface
pApplication->Release();
pApplication = NULL;
}
catch(_com_error &e)
{
OutputDebugString(e.ErrorMessage());
HRESULT hr = e.Error();
}
catch(...)
{
OutputDebugString("C++ exception in CPPTSink::ConnectSink");
}
}

best regards, Calin
 
B

Bill Dilworth

I don't speak C++, but it looks for all the world like you are trying to get
the full name off of the presentation you just closed. I'd guess you need
to either reset your object to the current presentation or get the full name
before you close it.



--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
C

Calin

No.
I call Close method on the interface pointer (object reference) returned by
Open method, which belongs to the temporary presentation.

regards, Calin
 

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