Board index » delphi » how to put Gif into resource file?

how to put Gif into resource file?

hi,
Does anybody knows how to store and retrive a gif file from resource ?.

TIA

Bill

 

Re:how to put Gif into resource file?


Generally you can store anything in resource file, create the files on your
program directory from resouce in FormCreate event (and delete in in
FormDestroy event if you want :).

To store any type of file you want in resource, you need resource compiler.
I use BRCC32.EXE in bin directory of Delphi 5 (but other should work).

Just create text file like this

THENAME1       GIF       "YOURFILENAME.GIF"
THENAME2       GIF       "YOURFILENAME2.GIF"

The first column is your resource name. The second column is resource type
(it can be any name but should not be something already use by standard-like
bmp). Change the file extension to .rc.

run

brcc32 YourResourceFileName.rc

at the command prompt and it will create "YourResourceFileName.res"

To create "YourFileName.Gif", just create TFileStream (your file that will
create in program directory) and TResourceStream. Use method

YourFileStream.CopyFrom(YourResourceStream).

After free both instances, the file will close and you can read it "from
file".

Hope this can help

Hague

Quote
Bill Toh wrote in message <8aitp3$m8...@clematis.singnet.com.sg>...
>hi,
>Does anybody knows how to store and retrive a gif file from resource ?.

>TIA

>Bill

Other Threads