Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Include .Wav Files into your .EXE File Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
24-Jan-03
Category
Multimedia
Language
Delphi 3.x
Views
75
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler

How to Include .Wav Files into your .EXE File

Answer:

STEP 1:

Create a resource script file (*.RC) with a simple text editor like Notepad and add 
the following line:

1 WAVE "MyWav.wav"

The '1' is simply the index of the resource.  The 'WAVE' specifies that we are 
dealing with a WAVE FILE user-defined resource.  The third and final entry is the 
name of the Wav file.

STEP 2:

User Borland's Resource Compiler, BRCC32.EXE, to compile it into a .RES file.  At 
the MS- DOS command line, type:

BRCC32 MyWav.RC

This will create a resource file called MyWav.RES.

STEP 3:

Add a compiler directive to the source code of your program.  It should immediately 
follow the form directive, as shown here:

1   {$R *.DFM}
2   {$R MyWAV.RES}


STEP 4:

Add the following code to your project:

3   procedure TForm1.Button1Click(Sender: TObject);
4   begin
5     PlaySound(PChar(1), HInstance, snd_ASync or snd_Memory or snd_Resource);
6   end;


You can add as many .Wav files as you want, just by adding another index number to 
your list, and call it using the PChar(index) in the PlaySound line.

STEP 5:

Run your program and click on the button, and enjoy.

Hint:  MMSystem must be in the uses clause! 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC