Ok, here is how easy it is to play a file using DirectShow:
1. Add "ActiveMovie control type library" as reference (quartz.dll) in VB (via
Project/Add Reference... menu)
2. Declare a FilgraphManager variable:
Code:
Dim mGraph as New QuartzTypeLib.FilgraphManager()
3. Write your Play and Stop functions:
Code:
Private Sub PlayFile(ByRef strFileName As String)
mGraph = New QuartzTypeLib.FilgraphManager()
mGraph.RenderFile(strFileName)
mGraph.Run()
End Sub
Private Sub StopFile()
mGraph.Stop()
End Sub
That's it! Just pass in any music or video filename into PlayFile and it will start playing. You can use the IVideoWindow interface to draw the video in one of your own windows and do things like full screen, etc. You can use the IMediaPosition interface to pause, ff, rew, skip, get current time/position, etc. You can use the IBasicAudio interface to set the balance and volume. It will automatically use all of the codec installed in your system (DivX, XviD, WinDVD, blah, blah, blah...)
It doesn't get any easier than that.
