M
Mike M.
I have written code to recognize the above and check for the Windows Media
Player object. I then get that object and can find the path (url) to the
source file. Now I need to do this for a Shockwave object (director file).
It is a pain to track down the dll to import into Visual C++, dig through
the references and figure out how to get the path to the source file. Not
to mention the other umpteen (S.R. school of terminology) objects that might
be inserted into a presentation. Does anyone know of a generic method to
determine if the shape has a linked file and how to get to path?
Thanks.
Here is some snippets of code I use for Media Objects and WMP:
if( shapeType == Office::msoMedia )
{
int mediaType;
PowerPoint::LinkFormatPtr lfp;
mediaType = pWorkingShape->GetMediaType();
// see if we can get a link format pointer.
lfp = pWorkingShape->GetLinkFormat();
currPathName = ( char * )lfp->GetSourceFullName();
// blah, blah
}
else if( shapeType == Office::msoOLEControlObject )
{ // check for embedded ole objects. Specifically Windows Media Player.
It may have a file.
CString newFileName; // just the file name
CString wmpName;
BSTR oleProgId;
CString szProgId;
IDispatchPtr wmp;
bool b_ret;
WMPLib::IWMPCore *core;
PowerPoint::OLEFormatPtr oleFormat;
// Get the format for the OLE object
oleFormat = pWorkingShape->GetOLEFormat();
oleFormat->AddRef();
// Get the program ID and make sure it is WMP.
oleProgId = oleFormat->GetProgID();
szProgId = TEXT(oleProgId);
if(strncmp(szProgId, "WMPlayer.OCX", 12) == 0)
{
// Get the ole player core object
wmp = oleFormat->GetObject();
wmp->AddRef();
// Get the core interface
wmp->QueryInterface(__uuidof(WMPLib::IWMPCore), (void **)&core);
core->AddRef();
// Get the url of the linked file
wmpName = (char *)(core->GetURL());
// blah, blah
}
This type of logic will be a pain for the bazillion possible objects.
Player object. I then get that object and can find the path (url) to the
source file. Now I need to do this for a Shockwave object (director file).
It is a pain to track down the dll to import into Visual C++, dig through
the references and figure out how to get the path to the source file. Not
to mention the other umpteen (S.R. school of terminology) objects that might
be inserted into a presentation. Does anyone know of a generic method to
determine if the shape has a linked file and how to get to path?
Thanks.
Here is some snippets of code I use for Media Objects and WMP:
if( shapeType == Office::msoMedia )
{
int mediaType;
PowerPoint::LinkFormatPtr lfp;
mediaType = pWorkingShape->GetMediaType();
// see if we can get a link format pointer.
lfp = pWorkingShape->GetLinkFormat();
currPathName = ( char * )lfp->GetSourceFullName();
// blah, blah
}
else if( shapeType == Office::msoOLEControlObject )
{ // check for embedded ole objects. Specifically Windows Media Player.
It may have a file.
CString newFileName; // just the file name
CString wmpName;
BSTR oleProgId;
CString szProgId;
IDispatchPtr wmp;
bool b_ret;
WMPLib::IWMPCore *core;
PowerPoint::OLEFormatPtr oleFormat;
// Get the format for the OLE object
oleFormat = pWorkingShape->GetOLEFormat();
oleFormat->AddRef();
// Get the program ID and make sure it is WMP.
oleProgId = oleFormat->GetProgID();
szProgId = TEXT(oleProgId);
if(strncmp(szProgId, "WMPlayer.OCX", 12) == 0)
{
// Get the ole player core object
wmp = oleFormat->GetObject();
wmp->AddRef();
// Get the core interface
wmp->QueryInterface(__uuidof(WMPLib::IWMPCore), (void **)&core);
core->AddRef();
// Get the url of the linked file
wmpName = (char *)(core->GetURL());
// blah, blah
}
This type of logic will be a pain for the bazillion possible objects.