Mega Code Archive

 
Categories / Delphi / Examples
 

Using an avi file with tanimate

Question: How can I resource an AVI so the TAnimate control doesn't have to rely upon an external file? Answer: There is an AVI Type, which is not used often, called 'AVI' and if you create a .RES file, Resource file, with this type it will allow you to use the resource as an AVI. The steps are: Create a new RES file. (Resource Workshop is good but it must be a 32-bit resource file) Add the AVI to the RES Project as a New Type specified as 'AVI'. (ie File | "Add to project..." in Resource Workshop and followed by clicking on the "New Type" button) NOTE:Make sure to edit the Name of the Resource (from 'AVI_1') to a more meaningful name before saving the project. (maybe 'About') - case sensitive. Save the RES Project to a name (ie RORY.RES) Back in Delphi 3, add the RES file in with the $R Compiler directive (ie {$R 'C:\AVI\RORY.RES'} ) Programmatically, set the TAnimate's RESName property to the Resource name. (Not the Type; AVI) Example: Animate1.RESName := 'About'; Animate1.Active := True;