DelphiFAQ Home Search:

Use a WAVE file as a resource in your EXE

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

This is an unexpected easy procedure! You don't even need Borland's Resource Workshop for this task.

Create a text file as shown in the table below; it should contain a link to the WAV file you want to include.
Name this file e.g. "MySound.RC".
If you want to include more than one WAV file, just add more lines with different identifiers in the first column.

HELLO WAVE "c:/winnt40/media/chimes.wav"

Then use the commandline resource compiler BRCC32.EXE like this:

BRCC32 MySound.RC

A resource file MySound.Res will be generated. Add this to your project
and use it like this:

uses
  MMSystem;
{$R MySound.Res}
procedure TForm1.PlaySndFromResClick(Sender: TObject);
begin
  PlaySound('HELLO', hInstance, SND_RESOURCE or SND_SYNC);
end;

Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: