VBGood网站全文搜索 Google

首页 - 经验之谈 - 让微机发出某种频率的声音
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:10613, 日期:2001-04-06
让微机发出某种频率的声音(2秒,可设置时间,仅用于Windows NT/2000)
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
` Attempt to play a note at 800 Hz for 2 seconds.  This will only
    ` behave this way on Windows NT/2000; users of Windows 95/98 will only hear the
    ` default sound.
    Dim retval As Long  ` return value
    retval = Beep(800, 2000)  ` ideally, an 800 Hz tone for 2 seconds
End Sub