Using DirectShow to Play a Movie from Visual Basic

Environment: VC6 SP5

Playing a movie file (AVI, MPG) from C++ is simple if we use the DirectShow interfaces provided with each version of DirectX. However, if we want to use Visual Basic as a movie player, the DirectShow interfaces can be difficult to use.

That's why we have built (in C++) an ActiveX control for Visual Basic that allows us to play any movie file (compatible with DirectShow). The ActiveX object also provides the complete interface for controlling the movie playback (Start, Stop, Pause, and a trackbar; it also shows the current movie position and the total length of the movie).

The ActiveX exports three functions:

StartMovie [MovieName] Starts the specified movie

StopMovie Stops the specified movie

UnloadProgram Unloads the DirectShow interfaces

See also:

Play a Movie from C++
http://www.microsoft.com/Developer/.../Play_Movie_from_C++.htm

Control the Video Playback Window from C++
http://www.microsoft.com/Developer/.../Control_Video_Playback_Window_C++.htm

Downloads

Download demo project - 37 Kb
Download binaries only - 139 Kb


Comments

  • Very useful chunk of code and big timesaver

    Posted by Groaty on 10/19/2005 07:15pm

    Was having nightmares trying to put together a stand alone vid for presentation tomorrow. (24:00 here). With this code it became easy. Couple of tweaks, but not a lot - Good job.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds