PC Review


Reply
Thread Tools Rate Thread

Addin to determine when a Windows Media Player object has finished.

 
 
Mike M.
Guest
Posts: n/a
 
      12th Apr 2004
I am testing an addin to do the following:

Public WithEvents PPTEvent As Application
' See if I can get events from this object
Public WithEvents wmpObject As WindowsMediaPlayer

1. In SlideShowNextSlide, detect a Windows Media Player shape on a slide.
2. Set slide.SlideShowTransition.AdvanceOnTime = msoFalse
3. Set a reference to the WMP object and catch it's events.
4. In the WMP PlayStateChange event catch the wmppsStopped event and advance
the slide.

This works intermittently, sometimes the video clip doesn't start
automatically. Also, I don't want to leave the wmpObject set because I
think it will leak memory. I tried setting it to nothing but that causes PPT
to crash when the slide show finishes. I have also read some warnings about
doing anything in the WMP event functions that affects the object's state.
I think advancing the slide probably does that.

I am going to investigate using the Windows timer API to set a timer,
reacquire the WMP object and check it's state to see how that does. I don't
think it is as efficient as using the player object events though.

Anyone messed around with this before and has any suggestions to offer?

TIA


 
Reply With Quote
 
 
 
 
John Langhans [MSFT]
Guest
Posts: n/a
 
      12th Apr 2004
[CRITICAL UPDATE - Anyone using Office 2003 should install the critical
update as soon as possible. From PowerPoint, choose "Help -> Check for
Updates".]

Hello,

If you (or anyone else reading this message) have suggestions for how to
make this easier to do in PowerPoint (perhaps being able to accomplish the
same end-result without requiring VBA <hint>), don't forget to send your
feedback (in YOUR OWN WORDS, please) to Microsoft at:

http://register.microsoft.com/mswish/suggestion.asp

It's VERY important that, for EACH wish, you describe in detail, WHY it is
important TO YOU that your product suggestion be implemented. A good wish
submssion includes WHAT scenario, work-flow, or end-result is blocked by
not having a specific feature, HOW MUCH time and effort ($$$) is spent
working around a specific limitation of the current product, etc. Remember
that Microsoft receives THOUSANDS of product suggestions every day and we
read each one but, in any given product development cycle, there are ONLY
sufficient resources to address the ones that are MOST IMPORTANT to our
customers so take the extra time to state your case as CLEARLY and
COMPLETELY as possible so that we can FEEL YOUR PAIN.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions).

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

 
Reply With Quote
 
Mike M.
Guest
Posts: n/a
 
      12th Apr 2004
o.k. Done. Anybody have some suggestions for my addin? I am having trouble
getting my PowerPoint with events to play nicely with the WMP object. Many
times it doesn't auto start the movie when I run the show.


""John Langhans [MSFT]"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> [CRITICAL UPDATE - Anyone using Office 2003 should install the critical
> update as soon as possible. From PowerPoint, choose "Help -> Check for
> Updates".]
>
> Hello,
>
> If you (or anyone else reading this message) have suggestions for how to
> make this easier to do in PowerPoint (perhaps being able to accomplish the
> same end-result without requiring VBA <hint>), don't forget to send your
> feedback (in YOUR OWN WORDS, please) to Microsoft at:
>
> http://register.microsoft.com/mswish/suggestion.asp
>
> It's VERY important that, for EACH wish, you describe in detail, WHY it is
> important TO YOU that your product suggestion be implemented. A good wish
> submssion includes WHAT scenario, work-flow, or end-result is blocked by
> not having a specific feature, HOW MUCH time and effort ($$$) is spent
> working around a specific limitation of the current product, etc.

Remember
> that Microsoft receives THOUSANDS of product suggestions every day and we
> read each one but, in any given product development cycle, there are ONLY
> sufficient resources to address the ones that are MOST IMPORTANT to our
> customers so take the extra time to state your case as CLEARLY and
> COMPLETELY as possible so that we can FEEL YOUR PAIN.
>
> IMPORTANT: Each submission should be a single suggestion (not a list of
> suggestions).
>
> John Langhans
> Microsoft Corporation
> Supportability Program Manager
> Microsoft Office PowerPoint for Windows
> Microsoft Office Picture Manager for Windows
>
> For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
> support center at: http://support.microsoft.com/default.aspx?pr=ppt
> Search the Microsoft Knowledge Base at:
> http://support.microsoft.com/default.aspx?pr=kbhowto
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
> Use of any included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>



 
Reply With Quote
 
Mike M.
Guest
Posts: n/a
 
      13th Apr 2004
I am testing just trying to recognize the WMP object and stop the slide form
advancing on time. The code below works if the first slide does NOT contain
a WMP object. If the first slide contains a WMP object the show seems to
get stuck in a loop doing next slide with slide 1. If I comment out the
code to set the AdvanceOnTime property then it works fine but of course
advances before the movie is finished. Why would setting that property
cause the show to malfunction?

Public WithEvents PPTEvent As Application

Private Sub PPTEvent_SlideShowNextSlide(ByVal Wn As SlideShowWindow)
Dim slide As PowerPoint.slide
Dim shp As PowerPoint.Shape
Dim shapeType As Integer
Dim progID As String
Dim wmpObject As WindowsMediaPlayer

' This contains the current slide.
Set slide = Wn.View.slide

LogIt "Next slide event for slide " & slide.SlideNumber & "."

' Check each shape for special ones
For Each shp In slide.Shapes
With shp
' See if it is an OLE WMP active x control.
shapeType = .Type
If (shapeType = 12) Then
progID = .OLEFormat.progID
If (progID = "WMPlayer.OCX.7") Then
LogIt "Found WMP shape."
Set wmpObject = .OLEFormat.Object
If (wmpObject.Name = "WindowsMediaPlayer1") Then
' Don't let this slide advance on time. Do it when
video done
' slide.SlideShowTransition.AdvanceOnTime = msoFalse
' slide.SlideShowTransition.AdvanceOnClick = msoTrue
End If
End If
End If
End With
Next shp

LogIt "Exit function."

End Sub

Here is the log for when the code is commented out and it works:
Next slide event for slide 1.
Found WMP shape.
Exit function.
Next slide event for slide 2.
Exit function.
Next slide event for slide 3.
Exit function.

Here is when it is in and doesn't work:
Next slide event for slide 1.
Found WMP shape.
Exit function.
Next slide event for slide 1.
Found WMP shape.
Exit function.
Next slide event for slide 1.
Found WMP shape.
Exit function.
Next slide event for slide 1.
Found WMP shape.
Exit function.
Repeats until I terminate with Task Manager.


 
Reply With Quote
 
Mike M.
Guest
Posts: n/a
 
      13th Apr 2004
Hey Mike, there seems to be some problem with when the SlideShowNextSlide
event actually occurs or some such thing. If you put the same code in the
SlideShowBegin and don't do in SlideShowNextSlide for slide 1 then it works.
Why? I don't know but it does make it more difficult.

HTH ;-)


"Mike M." <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I am testing just trying to recognize the WMP object and stop the slide

form
> advancing on time. The code below works if the first slide does NOT

contain
> a WMP object. If the first slide contains a WMP object the show seems to
> get stuck in a loop doing next slide with slide 1. If I comment out the
> code to set the AdvanceOnTime property then it works fine but of course
> advances before the movie is finished. Why would setting that property
> cause the show to malfunction?
>
> Public WithEvents PPTEvent As Application
>
> Private Sub PPTEvent_SlideShowNextSlide(ByVal Wn As SlideShowWindow)
> Dim slide As PowerPoint.slide
> Dim shp As PowerPoint.Shape
> Dim shapeType As Integer
> Dim progID As String
> Dim wmpObject As WindowsMediaPlayer
>
> ' This contains the current slide.
> Set slide = Wn.View.slide
>
> LogIt "Next slide event for slide " & slide.SlideNumber & "."
>
> ' Check each shape for special ones
> For Each shp In slide.Shapes
> With shp
> ' See if it is an OLE WMP active x control.
> shapeType = .Type
> If (shapeType = 12) Then
> progID = .OLEFormat.progID
> If (progID = "WMPlayer.OCX.7") Then
> LogIt "Found WMP shape."
> Set wmpObject = .OLEFormat.Object
> If (wmpObject.Name = "WindowsMediaPlayer1") Then
> ' Don't let this slide advance on time. Do it when
> video done
> ' slide.SlideShowTransition.AdvanceOnTime =

msoFalse
> ' slide.SlideShowTransition.AdvanceOnClick =

msoTrue
> End If
> End If
> End If
> End With
> Next shp
>
> LogIt "Exit function."
>
> End Sub
>
> Here is the log for when the code is commented out and it works:
> Next slide event for slide 1.
> Found WMP shape.
> Exit function.
> Next slide event for slide 2.
> Exit function.
> Next slide event for slide 3.
> Exit function.
>
> Here is when it is in and doesn't work:
> Next slide event for slide 1.
> Found WMP shape.
> Exit function.
> Next slide event for slide 1.
> Found WMP shape.
> Exit function.
> Next slide event for slide 1.
> Found WMP shape.
> Exit function.
> Next slide event for slide 1.
> Found WMP shape.
> Exit function.
> Repeats until I terminate with Task Manager.
>
>



 
Reply With Quote
 
Steve Rindsberg
Guest
Posts: n/a
 
      13th Apr 2004
So good of you to stop by and help Mike solve his problems. ;-)

Remind me which version of PPT this is? And if 2003, have you tried the same
code in 2002 or 2000?

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com

 
Reply With Quote
 
Mike M.
Guest
Posts: n/a
 
      13th Apr 2004
Always willing to help Mikey. PPT 2002. I have a draft copy of it working
now. It is wierd in that you can't do anything in the media player event
routines that affects the play state so I have to set a flag, set a timer,
catch the timer, check the flag, advance the slide, jump off a cliff, go to
the local cinema, talk to Mary Lou......

Oh yeah, and Eat Sauteed Sea Worms!!!!! :-O

"Steve Rindsberg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> So good of you to stop by and help Mike solve his problems. ;-)
>
> Remind me which version of PPT this is? And if 2003, have you tried the

same
> code in 2002 or 2000?
>
> --
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com
> PPTools: www.pptools.com
>



 
Reply With Quote
 
Steve Rindsberg
Guest
Posts: n/a
 
      14th Apr 2004
In article <OrQ#(E-Mail Removed)>, Mike M. wrote:
> Always willing to help Mikey. PPT 2002. I have a draft copy of it working
> now. It is wierd in that you can't do anything in the media player event
> routines that affects the play state so I have to set a flag, set a timer,
> catch the timer, check the flag, advance the slide, jump off a cliff, go to
> the local cinema, talk to Mary Lou......


Ug Lee. But ugly working is better than pretty and not, I guess.

> Oh yeah, and Eat Sauteed Sea Worms!!!!! :-O


S'awright, you'cn have mine.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine and jump next item when media finished playing kimiraikkonen Microsoft VB .NET 0 6th Nov 2007 06:47 PM
WINDOWS MEDIA PLAYER OBJECT Gabriele Murari Microsoft ASP .NET 0 26th Jun 2007 11:14 AM
How do I insert a Windows Media Player object (in 07)? =?Utf-8?B?bWNuZW1l?= Microsoft Powerpoint 3 18th Apr 2007 02:04 PM
Windows media player object =?Utf-8?B?UHJlYmVu?= Microsoft Powerpoint 2 7th Jan 2004 10:56 PM
Windows Media Player Object on slide. Mike M. Microsoft Powerpoint 0 29th Oct 2003 10:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 AM.