Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitlePlay an MPEG file using ActiveMovie
KeywordsMPG, MPEG, video, play, ActiveMovie
CategoriesMultimedia
 
Create a filter graph manager and invoke its RenderFile method. Use an IMediaEvent's WaitForCompletion method to wait until the file is done.
 
' Open the device and play the sound.
Private Sub cmdPlay_Click()
Dim media_control As Object
Dim media_event As IMediaEvent
Dim event_code As Long

    ' Get an object on the filter graph manager
    Set media_control = New FilgraphManager
 
    ' Open the file and build a filter graph
    media_control.RenderFile txtFilename.Text

    ' Play the file.
    media_control.Run

    ' Get the IMediaEvent interface
    Set media_event = media_control
 
    ' Wait for the video to finish
    media_event.WaitForCompletion 99999, event_code

    ' Free all interfaces
    Set media_event = Nothing
    Set media_control = Nothing
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated