Library tutorials & articles

Multimedia

Playing Animations

Several animations are provided when you install VB (look in the graphics folder under avi, or Videos), including the animations you see when copying files etc. To display these in VB, you need to use the Animation control. This is included with Microsoft Common Controls 2. To have this control added to your toolbox, select Project | Components. Then check the box next to Microsoft Common Controls 2 and click OK. You will now see at least 2 new controls added to your toolbox (5 if you are using VB6, 2 if you are using VB5).

The animation needs to be loaded at run time due to the amount of memory it is likely to use, so for now just add the empty control to your form. To load an animation, you use the Open function, which uses the following syntax:

Animation1.Open (Filename)

Once the animation has been opened you send the Play command for it to be run (unless AutoPlay is set to true):

Animation1.Play

To stop the animation, send the stop command:

Animation1.Stop

To remove the animation from memory, send the close command:

Animation1.Close

The following example, loads C:filecopy.avi (which is one of the animations provided with VB) and plays it continuously.

Animation1.Open ("C:filecopy.avi")
Animation1.Play

Comments

  1. 07 Aug 2005 at 20:40

    VISUAL STUDIO USER


    i am having the same situation but i got one step further because i can accurateley adjust the scroll to my track, you can do this by setting the tract time format to ms(milliseconds) then get the length of the track, then convert the length of the track to an integer, then set that as the spin max range, then get the scroll pos and format it into a String,  then get the sliders position and seek that.


    however the downfull of this is that you can only do this for one track, if find out how to do it to all the tracks please reply back

  2. 14 Feb 2004 at 01:48

    i found an easy way to display animated gif's to a form in vb http://mx.geocities.com/strikersdomain6/dxanimatedgif.zip
    easy to use and has instructions

  3. 31 Dec 2003 at 06:45

    i dont know exactly if this will work, but with MMControl1.position you can get the position...

  4. 06 Sep 2003 at 22:26
    Use this for simple animations such as gif's (convert your animation to gif)
  5. 23 Jul 2003 at 17:01
    Use the VB6 control
    Microsoft Animation Control 6.0 (SP4)
  6. 02 Jun 2003 at 00:01

    Is there an animation control for vb.net? or an equivelant component? I have almost given up on how to view the filecopy.avi in vb.net!
    Help? Thanks

  7. 09 Sep 2002 at 04:37

    Does VB6 handle Animated Gifs ? I am writing a program that requires certain buttons to change colour or flash
    when certain events occur.I am using a timer now , it does do the job but sinice i am using realtime event changes, the timer does not pick up some changes quick enough and the buttons end up changing or flashing at the wrong times.I have added checks and flags to the timer to try and handle this but cannot get 100%. Is there any other way?

  8. 28 May 2002 at 12:31

    http://www.developerfusion.com/show/62/1/


    ...has all the information you may need to add a slider to the MediaPlayer.  I cannot garentee that it will work like you want it to on all of it but if you have visual studio you may use the "Advanced API Text Viewer" under the "VisualStudio Tools" directory of the start menu.  Any questions please just feel free to reply and I will get back to you as soon as I can!


    (VISUAL STUDIO 6 user)

  9. 12 May 2002 at 22:37

    I'm currently writing a program to play .WAV files as I've just started learning VB. The MCI Control is powerful but what if I wanted to add a Slider Bar to control the positioning of the Audio File (Like MediaPlayer does)?


    Regards

  10. 01 Jan 1999 at 00:00

    This thread is for discussions of Multimedia.

Leave a comment

Sign in or Join us (it's free).

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...
AddThis

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

Want to stay in touch with what's going on? Follow us on twitter!