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

How to store AVI files in resource files

25 views
Skip to first unread message

Praveen Naregal

unread,
Mar 10, 2003, 12:27:18 AM3/10/03
to
Hello,

Is it possible to store an AVI file in the resource file?How to achieve
this?

With Regards,
Praveen Naregal


Marc Scheuner

unread,
Mar 10, 2003, 2:42:21 AM3/10/03
to
On Mon, 10 Mar 2003 10:57:18 +0530, "Praveen Naregal"
<pgna...@hotmail.com> wrote:
>Is it possible to store an AVI file in the resource file?How to achieve
>this?

1) Add a MyAVI.RC file to your project (it's a straight text file),
which contains:


MYAVI1 RCDATA c:\test\myavi1.avi
MYAVI2 RCDATA c:\test\myavi2.avi

When you have this added to your Delphi project, the IDE will compile
it into a .RES file.

2) Add an "include" clause to one of your units, where you will be
using these AVI's:

unit MyAVIs;

{$R MyAVI.RES}

3) To get at the AVI, you can open a resource stream, and get a hold
of a given AVI resource like so:

uses
Classes;

var
rsmAVIs : TResourceStream;
begin
rsmAVIs := TResourceStream.Create(hInst, 'MYAVI1', RT_RCDATA);

Now you have a stream which contains the AVI.

Also, you could use TAnimate directly and specify the ResHandle and
ResName properties, to refer to a resource AVI.

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.sch...@inova.ch

Praveen Naregal

unread,
Mar 10, 2003, 7:26:06 AM3/10/03
to
hi Marc,

I have been able to create the resouce file as per your instructions.
But I am not able to load the AVI into TAnimate. This is what I have done.

I have created avi.rc file and added it to the project.It compiled
successfully and a avi.res file is created.I included this .res file to the
application and created the resouce stream.

Now how to load this resouce into TAnimate control and play the AVI.

Thanks & Regards,
Praveen Naregal


"Marc Scheuner" <no....@for.me> wrote in message
news:05go6vcqi6ea84v2q...@4ax.com...

Marc Scheuner

unread,
Mar 11, 2003, 2:58:39 AM3/11/03
to
On Mon, 10 Mar 2003 17:56:06 +0530, "Praveen Naregal"
<pgna...@hotmail.com> wrote:
>I have created avi.rc file and added it to the project.It compiled
>successfully and a avi.res file is created.I included this .res file to the
>application and created the resouce stream.
>
>Now how to load this resouce into TAnimate control and play the AVI.

Once you have a TAnimate on your form (drop it onto the form, or
create it in code), you should be able to just specify that resource
name, and off you go:

var
oAnimate : TAnimate;
begin
oAnimate := TAnimdate.Create(self);

oAnimate.ResHandle := hInstance;
oAnimate.ResName := 'MyAVI_in_RES';

oAnimate.Active := True;
end;


You might want to check out these links:

http://delphi.about.com/library/weekly/aa021301a.htm
http://delphi.about.com/library/weekly/aa113099.htm

Praveen Naregal

unread,
Mar 11, 2003, 8:35:01 AM3/11/03
to
Hi Marc,

I got it.I am able to store AVI files in resource files and use them.
Thanks for your help.

Regards,
Praveen Naregal

"Marc Scheuner" <no....@for.me> wrote in message
news:05go6vcqi6ea84v2q...@4ax.com...

0 new messages