ccrpminilogo.gif (1886 bytes)  Knowledge Base
 KB Index    FAQ Index    Controls  
CCRP Control FAQ
Tuesday, January 06, 2004
FAQ: Using the Animation Control to Load AVI Resources

Animation Control

FAQ Index

The Animation Control FAQ
by Jeremy Adams

FAQ: Using the Animation Control to Load AVI Resources

Using this control it is possible to display an AVI included as a resource within the compiled EXE and such that it is not necessary to distribute the original AVI files with the application.

This file provides a brief overview of the ins and outs of including AVI resource in your application and a catches you should be aware of. The catch is that the control is not able to display an AVI resource whilst the program is being run within the IDE. Therefore, you must compile the application to an EXE and run the EXE to correctly load and play an AVI Resource.

The first step to including an AVI resource into your application is to create a resource template (.RC) file containing something like this:

1 AVI DISCARDABLE filecopy.avi

The first number is the unique identifier of the resource. The resource must be of type AVI or else the control will not load the resource. Finally, you should specify that the resource is discardable and then give the name of the file that you wish to include as a resource.

Once you have created this file, you need to use a resource compiler to create a .RES file (Microsoft supply a resource compiler with most of their development products called RC.EXE).

Once you have created the .RES file, go to your project in VB5, select Project, Add File... and select the .RES file you have just created. The .RES file will be added under related documents and will be compiled into the EXE when you build your project.

To display the AVI resource, place a ccrpAnimation control on a form and in the appropriate section of the code, add the line:

    ccrpAnimation.OpenAVIResource 1, App.hInstance

replacing 1 by the unique identifier of the resource as defined in the RC file. You must pass App.hInstance as the last parameter or the control will not be able to locate the resource. If you Autoplay set to true for the control then the AVI will start playing once this line is executed. If not, you will need to call the Play method to start the AVI playing.

This is all that is required to include an AVI resource into your application and play it. If you are a registered owner of VB5, you can simplify the management of resource files within the IDE by downloading the VB Resource Editor addin from the Visual Basic owner's site (link from

An example project demonstrating the use of AVI resources can be found in RESDEMO.ZIP included with this file.

If you intend to use standard resources as used by Windows Explorer such as the File Copy animation or Find File animation, they can be loaded directly by the control simply by calling the OpenStandardAVIResource method. Currently this method can load the resources equivalent to the following files
provided with VB5:

Find Folder SEARCH.AVI
Find Computer FINDCOMP.AVI
File Copy (Similar to FILECOPY.AVI)
Delete to Recycle Bin FILEDEL.AVI
Empty Recycle Bin FILENUKE.AVI

If you have any questions about the animation control, email me at


Jeremy Adams