|
I have tried to get the Windows API PlaySound to work in my VB application. It plays no sound. Any suggestions ?
Here is my code :
In a seperate module I declare all my API functions ...
*********************************
Public Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_LOOP = &H8
Public Const SND_NODEFAULT = &H2
Public Const SND_SYNC = &H0
Public Const SND_NOSTOP = &H10
Public Const SND_MEMORY = &H4
Public Const SND_RESOURCE = &H40004
**********************************
in Form1 module, Command1_Click()...
Dim intRet As Long
Dim SoundArray() As Byte
SoundArray = LoadResData(5001, "Custom")
intRet = PlaySound(SoundArray(0), App.hInstance, _
SND_RESOURCE Or SND_ASYNC Or SND_LOOP)
NO SOUND is heard, when button is clicked. Originally, it played a default sound, and even after ending my program, the default sound continued to loop. I closed VB6 and then the default sound which had still been looping stoped. I started program again after adding SND_NODEFAULT flag to the PlaySound function .... but since then there is no sound. I then took out the SND_NODEFAULT flag and now it doesn't even play a default sound.
Thanks for any help possible!
|
|
|
I imaging by now you have found the answer. If not, Peter Wright covers the issue with sample code in his book "beginning Visual Basic 6". If you need it, I can send you the code snippet.
Linky, philiplink@comcast.net
2/1/2004
|
|
|
I think the question is difficult for me to ansewr! I'm sorry i can't give you any helpness!
-------------------------------------------- flash banner|logo maker|flash menu|
|
|
|
|
|
|
|
|