0

I have an AVI file that I pulled from shell32 using Resources Extract. I would like to use this with TAnimate but I can't figure out how to load this file.

I succesfully loaded the AVI into a .RES file using DelphiDabbler's rcdatacreator program (you have to download the "worked example" to get rcdatacreator. However, my issue now is figuring out how to extract the AVI file from the .RES and supplying it to TAnimate.

I am using Delphi 2010:

enter image description here

Any help is appreciated.

Mick
  • 13,248
  • 9
  • 69
  • 119

1 Answers1

10

As Andreas mentioned (in his now deleted answer), you don't need to use an external tool to add the resource in recent versions of Delphi.

Use Project/Resources and Images... from the IDE menu. Add a new resource by browsing to the folder your .AVI file is in, give it a name, and type in AVI for the Resource Type. (It's not in the list, but you can add it.)

Delphi Resources Editor

At runtime, use the following code:

// I used CoolAVI as the resource name in my image above,
// so that's the name I need to use here.
Animate1.ResName := 'COOLAVI';
Animate1.Active := True;
Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Thanks, Andreas. I tried to get you to change your answer instead. :) – Ken White Sep 10 '11 at 21:53
  • I don't have "AVI" as a resource type in Delphi 2010. Is there a way to add that another way? – Mick Sep 10 '11 at 22:20
  • Unfortunately, in my Delphi 2010 project I could not modify the type using the IDE. However, opening up the DPROJ file and manually setting the type to AVI worked. – Mick Sep 11 '11 at 01:14
  • @KenWhite I tried it with `cool.avi` and it works fine. Then I tried it with an other animation file `websend.avi` (of course gave it an other resource id name: WEBSENDAVI) which crashed the program with an error message: "Cannot open AVI.". So it seems this works only with certain types of AVI files. Which AVI file type is supposed to work in this way with TAnimate? – user1580348 Jul 18 '13 at 10:07
  • @user1580348: According to the [docs](http://docwiki.embarcadero.com/RADStudio/XE4/en/Animation_Control), "uncompressed AVI files or AVI clips compressed using run-length encoding". I don't know anything about `websend.avi`, so I can't help there. We use a couple of non-standard AVIs this way without any issues. – Ken White Jul 18 '13 at 12:26