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