播放音乐
'无需添加控件
'最简单的WAV声音或音乐文件播放的代码
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Private Function PlayWavSound(SoundFile As String) As Long
Dim lFlags As Long
lFlags = SND_ASYNC Or SND_NODEFAULT
PlayWavSound = sndPlaySound(SoundFile, lFlags)
End Function
Private Function StopWavSound(SoundFile As String) As Long
Dim lFlags As Long
lFlags = SND_ASYNC Or SND_NODEFAULT
StopWavSound = sndPlaySound(SoundFile, lFlags)
End Function
'##################################
Private Sub Command1_Click()
Call PlayWavSound("C:\MeiLei_UG_WG\MeiLei_UG_WG\音\boink.wav")'调用方法【播放音乐】
End Sub
_____________________________________________________________________________ _
中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/ |