通用
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
按钮
Private Sub Command1_Click()
playwavefile = PlaySound("声音文件名.wav", 0&, lngflags)
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Dim X(24) As Integer, I As Integer, J As Integer
X(1) = 784: X(2) = 659: X(3) = 523: X(4) = 784
X(5) = 659: X(6) = 523: X(7) = 880: X(8) = 698
X(9) = 587: X(10) = 880: X(11) = 698: X(12) = 587
X(13) = 1568: X(14) = 1318: X(15) = 1046
X(16) = 1568: X(17) = 1318: X(18) = 1046
X(19) = 1760: X(20) = 1396: X(21) = 1174
X(22) = 1760: X(23) = 1396: X(24) = 1174
For I = 1 To 2
For J = 1 To 24
Beep X(J), 200
Next J
Next I
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Dim X As Integer, I As Integer
For I = 1 To 2
Beep 1784, 200
Next I
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Beep 1784, 400
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Beep 500, 900 '500表示频率,单位为㎐;900表示持续时间,单位为㎳。
End Sub
z正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Beep 500, 600 '500表示频率,单位为hz;600表示持续时间,单位为?。
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 Sub Command1_Click()
playwavefile = PlaySound("C:\Users\Administrator\Desktop\送别.wav", 0&, lngflags)
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 Sub Command1_Click()
PlaySound "F:\Sound\30.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Command2_Click()
PlaySound "F:\Sound\32.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
正确例题
Private Sub Form_Load()
WindowsMediaPlayer1.URL = "C:\Users\Administrator\Desktop\Alan Walker-Faded.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
正确例题
Private Sub Form_Load()
WindowsMediaPlayer1.URL = "C:\Users\Administrator\Desktop\Alan Walker-Faded.mp3"
WindowsMediaPlayer1.Controls.play
WindowsMediaPlayer1.Controls.pause
WindowsMediaPlayer1.Controls.stop
End Sub
正确例题
Private Sub Label1_Click()
WindowsMediaPlayer1.URL = "F:\sounds\1.mp3"
WindowsMediaPlayer1.Controls.play
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 Sub Label1_Click()
PlaySound "F:\Sound\1.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label2_Click()
PlaySound "F:\Sound\11.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label3_Click()
playwavefile = PlaySound("F:\Sound\31.wav", 0&, lngflags)
End Sub
Private Sub Label4_Click()
playwavefile = PlaySound("F:\Sound\41.wav", 0&, lngflags)
End Sub
Private Sub Label5_Click()
playwavefile = PlaySound("F:\Sound\51.wav", 0&, lngflags)
End Sub
Private Sub Label6_Click()
playwavefile = PlaySound("F:\Sound\57.wav", 0&, lngflags)
End Sub
Private Sub Label7_Click()
playwavefile = PlaySound("F:\Sound\61.wav", 0&, lngflags)
End Sub
正确例题
Private Sub Label1_Click()
WindowsMediaPlayer1.URL = "F:\sounds\1.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label2_Click()
WindowsMediaPlayer1.URL = "F:\sounds\2.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label3_Click()
WindowsMediaPlayer1.URL = "F:\sounds\3.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label4_Click()
WindowsMediaPlayer1.URL = "F:\sounds\4.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label5_Click()
WindowsMediaPlayer1.URL = "F:\sounds\5.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label6_Click()
WindowsMediaPlayer1.URL = "F:\sounds\6.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub Label7_Click()
WindowsMediaPlayer1.URL = "F:\sounds\7.mp3"
WindowsMediaPlayer1.Controls.play
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Label1_Click()
Beep 584, 400
End Sub
Private Sub Label2_Click()
Beep 984, 400
End Sub
Private Sub Label3_Click()
Beep 1584, 400
End Sub
Private Sub Label4_Click()
Beep 2784, 400
End Sub
Private Sub Label5_Click()
Beep 3784, 400
End Sub
Private Sub Label6_Click()
Beep 4784, 400
End Sub
Private Sub Label7_Click()
Beep 5784, 400
End Sub
正确例题
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Form_KeyPress(keyascii As Integer)
If keyascii = 49 Then
Call Label1_Click
Else
If keyascii = 50 Then
Call Label2_Click
End If
If keyascii = 51 Then
Call Label3_Click
End If
If keyascii = 52 Then
Call Label4_Click
End If
If keyascii = 53 Then
Call Label5_Click
End If
If keyascii = 54 Then
Call Label6_Click
End If
If keyascii = 55 Then
Call Label7_Click
End If
End If
End Sub
Private Sub Label1_Click()
Beep 584, 400
End Sub
Private Sub Label2_Click()
Beep 984, 400
End Sub
Private Sub Label3_Click()
Beep 1584, 400
End Sub
Private Sub Label4_Click()
Beep 2784, 400
End Sub
Private Sub Label5_Click()
Beep 3784, 400
End Sub
Private Sub Label6_Click()
Beep 4784, 400
End Sub
Private Sub Label7_Click()
Beep 5784, 400
End Sub
正确例题
Private Sub Command1_Click()
MMControl1.FileName = "F:\Sound\51.wav"
MMControl1.Command = "open"
MMControl1.Command = "play"
End Sub
测试例题
If KeyAscii = 49 Then'如果按下的是1键,注意1的Asc码是49
Call Command1_Click'那么执行command1点击事件
End If
假设这个按钮是command1,你只需要1行代码就行了.
Command1.Default = True
正确例题
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Label1_Click()
PlaySound "F:\Sound\41.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label2_Click()
PlaySound "F:\Sound\42.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label3_Click()
PlaySound "F:\Sound\43.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label4_Click()
PlaySound "F:\Sound\44.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label5_Click()
PlaySound "F:\Sound\45.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label6_Click()
PlaySound "F:\Sound\46.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
Private Sub Label7_Click()
PlaySound "F:\Sound\47.wav", 0&, SND_ASYNC + SND_FILENAME
End Sub
联系客服