Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TAnimate: loading AVI from resource

202 views
Skip to first unread message

Jeroen Hoffman

unread,
Nov 10, 1998, 3:00:00 AM11/10/98
to borland.public.delphi.vcl.components.using
I'd like to use a TAnimate component which reads the AVI-file from a resource file.
The Help says about TAnimate:
ResHandle is the Windows handle for the module that contains the AVI clip as a resource. Set ResHandle at runtime to the instance handle or module handle of the module that includes the animation resource. After setting ResHandle, set the ResID or ResName property to specify which resource in the indicated module is the AVI clip that should be displayed by the animation control.

So I think I have to do the following (and have some question with it):
1. Make a .res file with the AVI clip in it: is there a downloadable tool which can do this?
2. Including the resource with the $R directive (correct?)
3. Setting the ResHandle: which function can give me such a handle?
4. Setting the ResName

Can anyone give me some answers to my questions??
Thanks
Jeroen Hoffman

Nick Hodges (TeamB)

unread,
Nov 10, 1998, 3:00:00 AM11/10/98
to
On Tue, 10 Nov 1998 10:45:51 +0100, Jeroen Hoffman <jm.Ho...@ikm.nl>
wrote:

>So I think I have to do the following (and have some question with it):
>1. Make a .res file with the AVI clip in it: is there a downloadable
>tool which can do this?

You have one on your system -- BRCC32.EXE. You can create the script
like this

AVI MYAVI "C:\<somefilename>"

Save that text as a *.RC file and then run it through BRCC32.EXE (in
your Delphi BIN directory). That produces a *.RES file that you can
include in your application.


>2. Including the resource with the $R directive (correct?)

Correct.

>3. Setting the ResHandle: which function can give me such a handle?

You don't need to set this value. From the help --

"If a value is not specified for ResHandle, the animate control uses
the instance of the application’s main executable."

The application's main executable handle is what you want, so you
don't have to worry about this property.

>4. Setting the ResName
>

In the above case, set the RESName property to 'MYAVI'

Nick Hodges
TeamB

Jeroen Hoffman

unread,
Nov 16, 1998, 3:00:00 AM11/16/98
to borland.public.delphi.vcl.components.using
Hello again,

I followed the instructions of Nick Hodges and I still can't succeed in
loading an AVI from resource.

With brcc32.exe I compiled the file coolavi.rc containing the following:
AVI cool "cool.avi"
into coolavi.res

In a test application I did the following:

implementation

{$R *.DFM}

{$R coolavi.res}

procedure TForm1.Button1Click(Sender: TObject);
begin
Animate1.ResName := 'cool';

Animate1.Open := TRUE;
Animate1.Active := TRUE;
end;

I'm still getting the error 'Cannot open AVI' wich occurs while setting
ResName..
I tried lot's of things; moving the {$R } statement to the project source
file, using the FormCreate, FormShow,
even setting the Animate1.ResHandle using 'FindResourceHInstance
(Application.Handle)', which is not needed according to NH and Help..
and also using uppercase (you have to try it all...)!
I know the resource is linked into the exe because it's 20 Kb bigger.

Please does someone have any more suggestions?
Thanks in advance.

Jeroen Hoffman

Nick Hodges (TeamB)

unread,
Nov 16, 1998, 3:00:00 AM11/16/98
to
Jeroen,

A couple of comments --

The TAnimate control is limited by Windows in its ability to handle
AVI files -- they can't be compressed and they can't have any sound in
them. Think of TAnimate as nothing more than a control to display
flashlights and flying files --

Having said that, try making all the names you use capital letters
throughout your code and the RES file as well and see if that makes a
difference.


Nick Hodges
TeamB

Jeroen Hoffman

unread,
Nov 17, 1998, 3:00:00 AM11/17/98
to borland.public.delphi.vcl.components.using
Nick,

Having compiled a rc-file containing AVI MyAvi <filename>, we tried to
look at the res-file with Resource Workshop. We found out that the
structure was as follows:
MYAVI
AVI

So we compiled a rc-file containing MyAvi AVI <filename> into another
res-file: this time setting the animate.ResName to MYAVI worked and the
AVI showed!

Very glad it finally worked,
thanks for the support,
Jeroen Hoffman


0 new messages