使用VB中的beep语句只能发出一种声音。如果想发出不同声音,可以使用API函数。
Option Explicit
Private Declare Function APIBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
Dim frequency As Long
frequency = CLng(txtFrequency.Text)
APIBeep frequency, 500
End Sub
- 还没有人评论,欢迎说说您的想法!