在vb6.0中怎样为按钮单击设置声音?如果能的话,请教高手祥解
3个回答
展开全部
Private Sub Command1_Click()
Call PlaySound("VideoShow.wav")
' 你的按钮事件代码
End Sub
模块代码:
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
Public Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
' flag uitzetten
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_MEMORY = &H4
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10
Public Sub PlaySound(strSound As String)
sndPlaySound strSound, SND_ASYNC Or SND_NODEFAULT
End Sub
Call PlaySound("VideoShow.wav")
' 你的按钮事件代码
End Sub
模块代码:
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
Public Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
' flag uitzetten
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_MEMORY = &H4
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10
Public Sub PlaySound(strSound As String)
sndPlaySound strSound, SND_ASYNC Or SND_NODEFAULT
End Sub
展开全部
Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
在click 事件里写
beep 1000,100
在click 事件里写
beep 1000,100
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
想要什么样的声音?多大
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询