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
>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
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
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
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