Wav file inside a DLL ??


I'm using BC++Builder 4.0.
I would like to have a dll with :
  - A Wav file INSIDE it
  - A function to save it to disk

The best thing  would be a function like:

Is it possible ? How should I do ? Any code example ?

Thanks to all,

Who is Participating?
alexoConnect With a Mentor Commented:
You can put the WAV file in a raw binary data resource (RT_RCDATA).

Use FindResource() to get a handle to it, LoadResource() to load it into a memory buffer, LockResource() to get a pointer to it, SizeofResource() to find its size and the normal file I/O functions to save it to a file.
renam00Author Commented:
Sounds good...
any detail to the way to put the wav into a raw binary data (I'am not use to work with Dll)
With MSVC you can "import" a WAV file into the resource editor.  I guess the BCB resource editor has something similar.

It doesn't matter if the resorce resides in a DLL or in an EXE file.

Two remarks:

1) You should use a custom resource type (e.g., "WAVE") instead of what I suggested earlier.

2) Windows-specific questions (such as this) are better asked in the windows programming area, not C++.
All Courses

From novice to tech pro — start learning today.