Re: using PlaySound within a dll
- From: "stacy" <stacyirish@xxxxxxxxxxxxx>
- Date: 4 Aug 2005 14:24:06 -0700
Thanks again for the ideas however my problem persists! One last
attempt before I give up on this...
I have now tried to simplify and compare:
The following code behind a form in an exe works fine:
Private Declare Function PlaySoundLong Lib "winmm.dll" Alias
"PlaySoundA" ( _
ByVal lpszName As Long, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (
_
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_RESOURCE = &H40004
Private Const SND_NODEFAULT = &H2
Private Const SND_MEMORY = &H4
Private Const SND_SYNC = &H0
Private Sub Command1_Click()
Dim x As Long
x = PlaySoundLong(101, App.hInstance, SND_RESOURCE Or SND_ASYNC)
If x = 0 Then MsgBox "FAILED!"
End Sub
But what I want to work is this:
Code behind form in exe:
Private Sub Command1_Click()
Dim X As New dllSound.Class1
X.MySound
End Sub
Code in dll Class1:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (
_
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Declare Function PlaySoundLong Lib "winmm.dll" Alias
"PlaySoundA" ( _
ByVal lpszName As Long, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_MEMORY = &H4
Private Const SND_SYNC = &H0
Private Const SND_RESOURCE = &H40004
Public Sub MySound()
Dim X As Long
X = PlaySoundLong(101, App.hInstance, SND_RESOURCE Or SND_ASYNC)
If X = 0 Then MsgBox "FAILED!"
End Sub
It is the same code, yes? Why why why is there no sound? Even in the
dll case, X is returning true but I hear nothing.
Any more thoughts?
Stacy
.
- Follow-Ups:
- Re: using PlaySound within a dll
- From: Ken Halter
- Re: using PlaySound within a dll
- References:
- using PlaySound within a dll
- From: stacy
- Re: using PlaySound within a dll
- From: Ken Halter
- Re: using PlaySound within a dll
- From: stacy
- Re: using PlaySound within a dll
- From: Bob Butler
- Re: using PlaySound within a dll
- From: stacy
- Re: using PlaySound within a dll
- From: MikeD
- Re: using PlaySound within a dll
- From: stacy
- Re: using PlaySound within a dll
- From: Tom Esh
- using PlaySound within a dll
- Prev by Date: Re: using PlaySound within a dll
- Next by Date: Re: using PlaySound within a dll
- Previous by thread: Re: using PlaySound within a dll
- Next by thread: Re: using PlaySound within a dll
- Index(es):
Relevant Pages
|