Borland C++ help

Discussion in 'Programmer's Corner' started by Art, May 12, 2009.

  1. Art

    Thread Starter AAC Fanatic!

    Sep 10, 2007
    Hi Guys,
    I've just figured out how to use the mediaplayer to play sound samples
    for button presses, etc., but would really like to have the wav files added to
    the program's resources so the wav files don't have to be distributed seperately
    with the program.

    Is there a way to have the wav files included in the compiled exe file?
    Cheers, Art.
  2. balisong


    Feb 26, 2008
    You can do that using resource files. Here's an example.
    You place 1.wav in your project folder.
    You create a file named WavRes.rc that contains the line WAVE1 WAVE "1.wav"
    You add WavRes.rc to the project.
    When you build the project, the wav file will be included and accessible using the resource name WAVE1.

    In you source file add #include <mmsystem.h> to define the Windows routine PlaySound.
    Use the call PlaySound("WAVE1", HInstance, SND_RESOURCE | SND_ASYNC); to play the sound.

    Ask if you need more help.