Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / July 2005

Tip: Looking for answers? Try searching our database.

Need help with Office::msoOLEControlObject

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike M. - 27 Jul 2005 18:25 GMT
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.
Austin Myers - 27 Jul 2005 18:51 GMT
I am not a C++ guy at all, (VBA is more my speed) but in general with PPT
you need to enumerate all objects on a slide and then test each for it's
type.  Yeah it's a pain but that's how it works. <g>

Austin Myers
MS PowerPoint MVP Team

PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com

> 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
[quoted text clipped - 57 lines]
>
> This type of logic will be a pain for the bazillion possible objects.
Mike M. - 27 Jul 2005 19:37 GMT
VB and C++ work pretty much the same.  In most cases it seems to be the same
interface exposed by the control/dohickey/thingamajig.  When I click the
more tools button in PPT it makes my head spin thinking of writing specific
code for each of those things.  I'd rather invent the internet (or did
someone already do that?).

I am sure Chirag or Shyam will pop in here with the two line of code answer
that allows me to go back to what I prefer to do all day.

No, not that!

> I am not a C++ guy at all, (VBA is more my speed) but in general with PPT
> you need to enumerate all objects on a slide and then test each for it's
[quoted text clipped - 69 lines]
> >
> > This type of logic will be a pain for the bazillion possible objects.
Austin Myers - 27 Jul 2005 19:47 GMT
Oh no, you need not be concerned with any controls other than what is on the
slide, that's why I said enumerate each object.  Am I missing what you are
after?

Austin Myers
MS PowerPoint MVP Team

PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com

> VB and C++ work pretty much the same.  In most cases it seems to be the same
> interface exposed by the control/dohickey/thingamajig.  When I click the
[quoted text clipped - 85 lines]
> > >
> > > This type of logic will be a pain for the bazillion possible objects.
Mike M. - 27 Jul 2005 21:08 GMT
Maybe we're saying different things about the same thing.  ;-)   I do loop
through each shape on each slide.  I need to determine if the shape has a
linked file so that I can copy it to the same directory as the presentation
and reset the link to be relative( sort of like Steve's fixlinks).  Our
customers build the presentations so I have no idea ahead of time what
controls they may decide to use.  I did the most obvious ones (media files)
and now I bump into these other cases now and then.  WMP, Shockwave, etc.
It would be really great if there was a generic way to determine there is a
linked file and where it is (like GetSourceFullName()).

Anyhooo, I now have the Shockwave working with control specific code.
Eeewwww.

Thanks.

> Oh no, you need not be concerned with any controls other than what is on the
> slide, that's why I said enumerate each object.  Am I missing what you are
[quoted text clipped - 98 lines]
> > > >
> > > > This type of logic will be a pain for the bazillion possible objects.
Steve Rindsberg - 27 Jul 2005 23:05 GMT
> Maybe we're saying different things about the same thing.  ;-)   I do loop
> through each shape on each slide.  I need to determine if the shape has a
> linked file so that I can copy it to the same directory as the presentation
> and reset the link to be relative( sort of like Steve's fixlinks).  

Y'know, a lot of these OLE thingummies don't allow that.
They may insist on a full path or nuthin'.
So given the original files and an alternate path where you want to move them,
you could do the job, but you can't necessarily set the path to nothing but the
filename like you can with movie/sound/image links.

It'll probably vary on a case by case basis.  
Lucky Mike.  I fear he may've been fed more than his digestive system's ready
for ... again.

Our
> customers build the presentations so I have no idea ahead of time what
> controls they may decide to use.  I did the most obvious ones (media files)
[quoted text clipped - 117 lines]
> > > > > This type of logic will be a pain for the bazillion possible
> objects.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Mike M. - 28 Jul 2005 13:57 GMT
Bit off more than he can chew?  Well, more like force fed.  The ShockWave
ActiveX Control does some weird things as I found out yesterday.  My program
builds the presentation, resets any links, ftps all files to a different
machine.  That machine has another app the moves the files to different
folders and then stops a previous pres and starts the new one.  With all
this moving about it works best to make the paths relative.  The ShockWave
(and WMP) control insists on full paths. However, the ShockWave control
seems to take care of itself.  When I checked the object in my pres in it's
intermediate ftp folders the full path to the folder was set in the SRC
(source) field.  When it was moved to it's final folder the correct path was
in the SRC field.  I swear I didn't do it.  WMP just keeps my .\filename.wmv
path and won't play.  The ShockWave actually played.  I will be doing some
more testing to see if I can figure this out.  Unfortunately when I tell
PowerPoint to Stop the show (pptOldPresentation->Close();), PowerPoint
crashes and asks me if I want to send a nice error message to the folks at
home.  So I have the fun task of looking into that also.

Well, seems like I am not going to get my magic elixir today.  I'll have to
settle for a Mountain Dew (as any good programmer would).

See ya.

> Y'know, a lot of these OLE thingummies don't allow that.
> They may insist on a full path or nuthin'.
[quoted text clipped - 134 lines]
> PPTools:  www.pptools.com
> ================================================
Mike M. - 28 Jul 2005 15:01 GMT
Well, I have a small VB test app to test with.  I have a button to open a
pres and one to close it and quit ppt (2002).   When I have a ShockWave
activex control pointing to a director file (.dcr) on a slide, when I call
the close method of ppt, ppt crashes.  I have a one slide pres with only the
control on it.  Now to figure out is it a ppt thing or Macromedia.

> Bit off more than he can chew?  Well, more like force fed.  The ShockWave
> ActiveX Control does some weird things as I found out yesterday.  My program
[quoted text clipped - 175 lines]
> > PPTools:  www.pptools.com
> > ================================================
Steve Rindsberg - 28 Jul 2005 20:39 GMT
> Well, I have a small VB test app to test with.  I have a button to open a
> pres and one to close it and quit ppt (2002).   When I have a ShockWave
> activex control pointing to a director file (.dcr) on a slide, when I call
> the close method of ppt, ppt crashes.  I have a one slide pres with only the
> control on it.  Now to figure out is it a ppt thing or Macromedia.

WAGging madly:  you maybe need to stop activity taking place in the activex
control (ie, douse the director file) before quitting?

> > Bit off more than he can chew?  Well, more like force fed.  The ShockWave
> > ActiveX Control does some weird things as I found out yesterday.  My
[quoted text clipped - 188 lines]
> > > PPTools:  www.pptools.com
> > > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Mike M. - 29 Jul 2005 16:39 GMT
That would require my application to have intimate knowledge of what is on
each slide of the presentation.  Currently that application is fairly simple
in that it just gets presentations from the server and starts them playing.
I don't really think that would help because I can get PPT to crash even if
the ShockWave control does not point to a file and is not playing.  Just by
inserting the control on a slide and not setting it to anything PPT crashes
when I close the pres.  For now I have decided to ditch PowerPoint and
control the ShockWave files directly using the ActiveX control through my
app (c++).  When I get the time I will research this more but deadlines are
looming.

Thanks.

> > Well, I have a small VB test app to test with.  I have a button to open a
> > pres and one to close it and quit ppt (2002).   When I have a ShockWave
[quoted text clipped - 4 lines]
> WAGging madly:  you maybe need to stop activity taking place in the activex
> control (ie, douse the director file) before quitting?
Steve Rindsberg - 27 Jul 2005 22:46 GMT
Hmmm.  I think you may be stuck, since each server app can pretty much expose
its own properties, no?

I'd be inclined, off top of head, to wrap the whole thing in a case selector
based on the shape's OLEProgID and call different functions depending on the
results.  It'd allow you to add new servers/methods to handle them as you go,
at least.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.