5个回答
展开全部
'全局代码,最上面
Private Const SND_ASYNC = &H1 '这个可以按一下就开始播放,不用等第一个播放完
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'下面 这个是代码部分,把它放在按钮的代码中
sndPlaySound "c:/1.wav", SND_ASYNC '声音代码
Private Const SND_ASYNC = &H1 '这个可以按一下就开始播放,不用等第一个播放完
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'下面 这个是代码部分,把它放在按钮的代码中
sndPlaySound "c:/1.wav", SND_ASYNC '声音代码
展开全部
在窗体上添加一个Windows Media Player控件 一个命令按钮
然后写如下代码,文件路径改为自己要播放的歌曲的路径
代码如下
Private Sub Command1_Click()
Open "F:\1030.mp3" For Binary As #1
Put #1, , app1
Close #1
WindowsMediaPlayer1.url = "F:\1030.mp3"
End Sub
然后写如下代码,文件路径改为自己要播放的歌曲的路径
代码如下
Private Sub Command1_Click()
Open "F:\1030.mp3" For Binary As #1
Put #1, , app1
Close #1
WindowsMediaPlayer1.url = "F:\1030.mp3"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用背景音乐可以实现,不需要用代码的,不过,你这个ogg格式,好像识别不了呀,另外建议不要用绝对路径,要用相对路径,方便后期的安装
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Sub Command1_Click()
PlaySound App.Path & "\Goodbye.wav", 0, SND_ASYNC
End Sub
Private Sub Form_Load()
' PlaySound App.Path & "\Goodbye.wav", 0, SND_LOOP + SND_ASYNC
End Sub
Private Sub Form_Unload(Cancel As Integer)
PlaySound 0, 0, 0
End Sub
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Sub Command1_Click()
PlaySound App.Path & "\Goodbye.wav", 0, SND_ASYNC
End Sub
Private Sub Form_Load()
' PlaySound App.Path & "\Goodbye.wav", 0, SND_LOOP + SND_ASYNC
End Sub
Private Sub Form_Unload(Cancel As Integer)
PlaySound 0, 0, 0
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
引用zx001z的回答:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Sub Command1_Click()
PlaySound App.Path & "\Goodbye.wav", 0, SND_ASYNC
End Sub
Private Sub Form_Load()
' PlaySound App.Path & "\Goodbye.wav", 0, SND_LOOP + SND_ASYNC
End Sub
Private Sub Form_Unload(Cancel As Integer)
PlaySound 0, 0, 0
End Sub
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Sub Command1_Click()
PlaySound App.Path & "\Goodbye.wav", 0, SND_ASYNC
End Sub
Private Sub Form_Load()
' PlaySound App.Path & "\Goodbye.wav", 0, SND_LOOP + SND_ASYNC
End Sub
Private Sub Form_Unload(Cancel As Integer)
PlaySound 0, 0, 0
End Sub
展开全部
第一个回答的是什么鬼?????
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询