Re: using PlaySound within a dll



On 4 Aug 2005 10:12:06 -0700, "stacy" <stacyirish@xxxxxxxxxxxxx>
wrote:

Problem is your declarations for the lpszSound arg do not match the
data type being passed. If it helps, I use this one. (Just have to
remember to pass ByVal when specifying a string or res ID in
lpszSound):

Public Declare Function PlaySoundAny Lib "winmm.dll" _
Alias "PlaySoundA" _
(lpSound As Any, ByVal hModule As Long, _
ByVal dwFlags As Long) As Long

'usage:
Dim DataArray() As Byte
DataArray = LoadResData(101, "WAVE")
PlaySoundAny DataArray(0), 0, _
SND_MEMORY Or SND_NODEFAULT Or SND_ASYNC

If that doesn't work, check to make sure your DataArray is actually
being populated (iow you're not passing a bad resID or type to
LoadResData).

-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
.