1个回答
展开全部
这个你要使用vb 的api函数来实现:mcisendstring
具体的例子:
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
添加一个按钮,
Private Sub Command1_Click()
mciSendString "close c:\windows\media\ding.wav", vbNullString, 0, 0
mciSendString "open c:\windows\media\ding.wav", vbNullString, 0, 0
mciSendString "play c:\windows\media\ding.wav", vbNullString, 0, 0
End Sub
如果你想实现有20个按钮,点每一个都会发出不同声音,方法和command1的实
现一样,试一试吧!
具体的例子:
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
添加一个按钮,
Private Sub Command1_Click()
mciSendString "close c:\windows\media\ding.wav", vbNullString, 0, 0
mciSendString "open c:\windows\media\ding.wav", vbNullString, 0, 0
mciSendString "play c:\windows\media\ding.wav", vbNullString, 0, 0
End Sub
如果你想实现有20个按钮,点每一个都会发出不同声音,方法和command1的实
现一样,试一试吧!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询