Public Declare Function PlaySoundData Lib "winmm.dll" Alias "PlaySoundA" (lpData As Any, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_MEMORY = &H4
Public Const SND_NOSTOP = &H10
Public Const Flags = SND_ASYNC Or SND_MEMORY
'上面的是定义在模块里Private Function PlaySnd(Index As Integer) As Long
Dim M_sound() As Byte
M_sound = LoadResData(Index, "WAVE")
play = PlaySoundData(M_sound(0), 0, Flags)
Erase M_sound
End Function
Public Const SND_ASYNC = &H1
Public Const SND_MEMORY = &H4
Public Const SND_NOSTOP = &H10
Public Const Flags = SND_ASYNC Or SND_MEMORY
'上面的是定义在模块里Private Function PlaySnd(Index As Integer) As Long
Dim M_sound() As Byte
M_sound = LoadResData(Index, "WAVE")
play = PlaySoundData(M_sound(0), 0, Flags)
Erase M_sound
End Function
不过sndPlaySoundA把ByVal lpszSoundName As String 改成lpszSoundName As Any也能播放资源文件