Board index » delphi » How to include a .wav file in a .exe file

How to include a .wav file in a .exe file

How do I include a .wav or a big Bitmap or the like in the compiled .exe
file ?

Peter :->

 

Re:How to include a .wav file in a .exe file


Peter,

Create a plain text file with the extension .RC (for this discussion,
we'll call it MYRES.RC).

In the text file, add a line for each of the resources you want
included, in the format RESOURCENAME  RESOURCETYPE  FILENAME:

MYWAV WAV MySoundFile.Wav
MYBMP BMP MyBitmapFile.Bmp

Make sure the resourcename is all upper-case.

From the command line (DOS prompt), run the Borland Resource
compiler (BRCC.EXE for Delphi 1, BRCC32 for Delphi 2/3). It's
located in your Delphi\Bin directory:

BRCC32 MYRES.RC

This creates MYRES.RES in the current directory.

Then add {$R MYRES.RES} to a single unit in your project (probably
best in the main form). If you add this to more than one file,
you'll get 'Duplicate Resource' errors.

Now you have the resources in your EXE as soon as you build or
run your EXE.

HTH

Ken
--
Ken White
kwh...@westelcom.com

Clipper Functions for Delphi
http://members.aol.com/clipfunc/

Quote
Peter Jacobsen wrote:

> How do I include a .wav or a big Bitmap or the like in the compiled .exe
> file ?

> Peter :->

Re:How to include a .wav file in a .exe file


Hi Peter!
Of course, the solution from Ken worx, but you can use also this thing:
if you wanna extract ANY file during session, you can just append it to the
end of your compiled exe, and then, append longint value, representing the
length of your appended file. Then, while working, your exe will extract
last four bytes from exe, then
seek(MainEXE,FilesSize(MainEXE)-SizeValue-SizeOf(SizeValue) and blockwrite
it to another file. Then truncate last four bytes (length) in the new file.
Maybe it is a bit complicated, but it works fine in my application (I
extract DLL from main EXE during working session as I want my application to
contain only one file).

Greets,

Jevgenij Gorbunov - gorbu...@med.muni.cz
----------------------------------------------------------------------------
Czech Republic, Brno. ICQ: 11471114.
Medicine, computers, translations, ...
----------------------------------------------------------------------------
Anyone sending me unsolicited/commercial/junk/spam e-mail
will be MAILBOMBED. So think before you act...
----------------------------------------------------------------------------

Peter Jacobsen ??? a ???? <35796D50.53825...@vip.{*word*104}city.dk> ...

Quote
>How do I include a .wav or a big Bitmap or the like in the compiled .exe
>file ?

>Peter :->

Re:How to include a .wav file in a .exe file


In article <35796D50.53825...@vip.{*word*104}city.dk>, Peter Jacobsen

Quote
<loneogpe...@vip.{*word*104}city.dk> writes:
>How do I include a .wav or a big Bitmap or the like in the compiled .exe
>file ?

If you look at the Unofficial Newsletter of Delphi Users Issue 10, Dec 1995 at
http://www.undu.com/ there's an article on doing that. If you use WAV file
resources you have to lock the resource (its all in UNDU) in D1 and D2,
otherwise windows moves it around and it can't be played. I think D3 you can
use TAnimate which locks for you.

Alan Lloyd
alangll...@aol.com

Other Threads