VB 声音提示

前端之家收集整理的这篇文章主要介绍了VB 声音提示前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long,ByVal dwDuration As Long) As Long

Private Sub Form_Load()
playsnd 587,100: playsnd 784,100: playsnd 880,100: playsnd 988,100:: playsnd 988,200: playsnd 0,100
playsnd 988,100: playsnd 1047,200: playsnd 988,100
playsnd 880,100: playsnd 100,150: playsnd 880,100: playsnd 0,(5)
playsnd 988,(5)::: playsnd 988,(5):::: playsnd 988,100
playsnd 784,100: playsnd 740,200: playsnd 100,200:: playsnd 784,100:: playsnd 0,100
playsnd 0,100: playsnd 587,100:: playsnd 784,100: playsnd 1175,(5)::: playsnd 1175,99: playsnd 988,(5)
playsnd 987,(5):::: playsnd 784,200
playsnd 784,(5)::: playsnd 784,50:: playsnd 659,(50)
playsnd 784,100: playsnd 659,100:: playsnd 100,110
playsnd 784,120: playsnd 880,130: playsnd 740,140: playsnd 784,200:: playsnd 1,1::::: playsnd 1,1
End Sub

Function playsnd(ByVal x As Long,y As Long)
Beep x,y * 3
DoEvents
End Function


-------------------------------------------------
-----
-----------------
Beep不行,用API。引用:
Public 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
例子:
mciSendString "close C:\Windows\Media\onestop.mid",vbNullString,0
mciSendString "open C:\Windows\Media\onestop.mid",0
mciSendString "play C:\Windows\Media\onestop.mid",0

猜你在找的VB相关文章