HELP! Stuffing Resources into a DLL, then using SoundPlay..

Greetings..  I'm writing a Delphi 2.0 application that needs to access
a large number of .WAV files (about 3MB worth).  I figured a good way
to load them quickly into memory would be to put them all into a
resource file and then compile the resource file into a DLL.  Then
from my application, I could do a LoadLibrary on my DLL and use the
'SoundPlay' function to play the wave files (since SoundPlay will play
a wave file straight from a resource).

This sounded easy enough, but I've been racking my brains for the past
two nights trying to get this to work.  This would be a piece of cake
in C/C++, but I'm having problems in Delphi.  The problem I'm having
is that the SoundPlay function is _not_ playing the sound file and
returns 'False' to indicate that it failed.  However, the
'GetLastError' function returns 0, so no useful information there.  

Here are the details.  The first thing I did was to create a resource
file..  Here's a small sampling of it:

// Resource file containing .WAV files


... and so forth.


The '' file contains all the constants.  I've tried defining
the constants in two different fashions, one using a Pascal Const
block, the other using #defines.  For example:
  IDSOUND_START    =  101;
  IDSOUND_EXIT     =  102;

And then I tried:
#define  IDSOUND_SHUFFLE  100
#define  IDSOUND_START    101
#define  IDSOUND_EXIT     102

I then used the BRC32 program in to compile the resource by simply

BRC32 sounds.rc

This produces a file by the name of 'sounds.res'.  I then created a
simple DLL, with a single file that contains (I'm typing this from
memory, so if I misplace semicolons, please don't holler!):


Library WavFiles;

  Windows;   { delphi complaining about no Uses
               statement, so I just put this in }

{$R sounds.res}


I then compile this, and presto, instant DLL.

Now in my executable initialization code I perform a LoadLibrary on
the DLL, which seems to work fine:

  HINSTANCE hWavInstance;  { global }

procedure InitializeSound;
  hWavInstance := LoadLibrary( 'wavfiles.dll' );

I then created a PlayWave function, which makes a call to the mmsystem
'PlaySound' API, as follows:

procedure PlayWave( aSoundID: Cardinal );
  PlaySound( MakeIntResource( aSoundID ), hWavInstance,

PlaySound returns False and of course, doesn't play the sound.  If I
remove the 'SND_NODEFAULT', then it does play the default system beep.
Another odd thing that I noticed is that if I try to use the
GetModuleHandle function on my 'wavfiles' DLL, it returns NULL (the
DLL is definitely in memory).  I initially had more code in my
PlayWave function (copied from the SPEAKN example on the MSDN CD), but
was able to reduce it all to the one line you see above (the SPEAKN
example used the sndPlaySound, which doesn't allow you to play
resources directly).  

It seems to me that the resource IDs are not being properly associated
with the resources in the resource file.  If that's the case, I could
understand why PlaySound fails.  Am I not creating the resource file
properly?  The only thing I haven't yet done (or so it seems) is
create the equivalent resource using Visual C++ 4.1.  I'll probably
try that tonight.

**Rant On**
While I'm here, I just want to say that the Delphi integrated de{*word*81}
is worthless.  I don't understand why Borland doesn't include Turbo
De{*word*81} with this product, especially since Delphi is now their most
expensive development platform.  That and the fact that they don't
give you the Resource Workshop.  What were they thinking??  I'm not
about to shell out $350 for BC++ 5.0..  Since Turbo De{*word*81} is not
sold standalone, you have to buy it bundled with something else, such
as Turbo Assembler.  But *NONE* of the stores locally (CompUSA,
Computer City, MicroCenter, Egghead) carry Turbo Assembler, so it
looks like I'll have to order it.  Borland is crazy to expect people
to pay $100 for a de{*word*81} because the one they ship in Delphi doesn't
work in the first place.  
**Rant Off**

If anyone can see anything that I might be doing wrong or can suggest
a better way to go about this problem, I'm all ears.  Thanks in
advance for any insight..  

 ..Al Yarusso