R
rcattral
Has anybody been using the PlaySound() function to play WAV files from
within a DLL? Here is what I normally do.
Since upgrading to 7.1 NET after using VC 6.0 for quite some time, I
found that I had to add the following lines in order to use the
multimedia extensions.
In stdafx.h
#include <MMSystem.h>
#pragma comment(lib, "winmm.lib")
After adding these, my old code compiles and still works. I basically
import a WAV file as a resource and then play it with the following
line:
bool played = PlaySound(MAKEINTRESOURCE(IDR_WAVE1), NULL, SND_ASYNC |
SND_RESOURCE);
In standard applications this works fine, however when I put this code
into a function that is being exported from within a DLL it fails. As
a first possible solution I tried to add the Manage_state macro at
the top of the function, as follows:
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
bool played = PlaySound(MAKEINTRESOURCE(IDR_WAVE1), NULL, SND_ASYNC |
SND_RESOURCE);
...
}
No luck...
Suggestions anyone?
within a DLL? Here is what I normally do.
Since upgrading to 7.1 NET after using VC 6.0 for quite some time, I
found that I had to add the following lines in order to use the
multimedia extensions.
In stdafx.h
#include <MMSystem.h>
#pragma comment(lib, "winmm.lib")
After adding these, my old code compiles and still works. I basically
import a WAV file as a resource and then play it with the following
line:
bool played = PlaySound(MAKEINTRESOURCE(IDR_WAVE1), NULL, SND_ASYNC |
SND_RESOURCE);
In standard applications this works fine, however when I put this code
into a function that is being exported from within a DLL it fails. As
a first possible solution I tried to add the Manage_state macro at
the top of the function, as follows:
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
bool played = PlaySound(MAKEINTRESOURCE(IDR_WAVE1), NULL, SND_ASYNC |
SND_RESOURCE);
...
}
No luck...
Suggestions anyone?