在click事件中调用一个播放声音的过程如果要求不是很高,用mmcontrol控件也凑或Sub music()
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = App.Path & "\utopia.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
MMControl1.Command = "prev"
End Sub
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = App.Path & "\utopia.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
MMControl1.Command = "prev"
End Sub
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long达到播放WAV的目的
建议制作Function一个,需要时调用,
在.Net中用继承把属性
ExitSnd
HoverSnd
DownSnd
DisableSnd
Add到一个新的按钮类上。
使用更方便
beep
....
....
....
end sub
然后,在该按钮的事件中添加播放声音命令.
'〖1〗
'添加声明:
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'〖2〗
'按钮事件
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
sndPlaySound app.path + "sound.wav",0
End sub