是否有可能让vb.net程序发出PC的内部扬声器声音?你知道那个产生C语言 \a
响铃声的扬声器吗?
我尝试过使用beep()
,但这只会在声卡上产生错误声音。
我也尝试过
<Runtime.InteropServices.DllImport("KERNEL32.DLL", EntryPoint:="Beep", SetLastError:=True, _
CharSet:=Runtime.InteropServices.CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall)> _
Public Shared Function _
aBeep(ByVal dwFreq As Integer, ByVal dwDuration As Integer) _
As Boolean
End Function
看起来这个功能似乎只在Vista及以上版本中有效。有什么建议吗?
Beep
函数会从内部系统扬声器发出蜂鸣声,就像你描述的那样。这与MessageBeep
函数形成对比,后者会在连接时从声卡发出蜂鸣声。64位版本的XP和Windows Vista是首批打破这种行为的操作系统。 - Cody Gray