建立VB6资源文件播放wav文件,出现“编译错误,在end sub,end End function或end属性后面只能出现注释!

2025-03-01 09:02:23
推荐回答(2个)
回答1:

'改成这样:
Option Explicit

Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Private Declare Function sndPlaySoundFromMemory Lib "winmm.dll" Alias "sndPlaySoundA" (lpszSoundName As Any, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1&
Private Const SND_MEMORY = &H4&

Private Sub Command1_Click()

Dim bArr() As Byte
bArr = LoadResData(101, "wave")
sndPlaySoundFromMemory bArr(0), SND_ASYNC Or SND_MEMORY

End Sub

回答2:

不能把Function放在Sub事件里,放在(通用)里