问题描述
windows vista 发布后的Windows Function 哔声在您连接的扬声器上播放哔声,而不是内部扬声器.
After the release of windows vista the Windows Function Beep plays a beep on your connected speakers instead of the internal one.
有没有办法访问旧功能?是否可以通过使用较旧的 Windows api 来实现?或者有没有其他方法可以让这成为可能?如果是这样,我希望能够同时设置频率和持续时间.
Is there anyway to access the old function? Would it be possible by getting hold in an older windows api? Or is there any other way i can make this possible? If so i would like the ability to set both the frequency and duration.
我应该提一下,我实际上是针对 windows xp 平台的.
I should mention that I´m actually targeting the windows xp platform.
推荐答案
没有.该函数在 Kernel32.dll 中实现,它在运行时从您当前运行的任何版本的操作系统加载.由于代码不存在于您的可执行文件或系统 DLL 中,因此您无法运行它(甚至不要考虑从不同的操作系统版本复制 Kernel32.dll,这只是在找麻烦).
No. The function is implemented in a Kernel32.dll, which is loaded at runtime from whatever version of the OS you're currently running. Since the code isn't there in either your executable or in a system DLL, you can't run it (don't even think about copying over Kernel32.dll from a different OS version, that's just screaming for trouble).
您可以尝试使用 MessageBeep
而不是 Beep
,但这让您对输出的控制较少,并且可能仍会使用您的声卡而不是内部的
You can try using MessageBeep
instead of Beep
, but that gives you less control over the output and will probably still use your sound card instead of the internal
有关 MessageBeep
函数的有趣历史,请参阅 Larry Osterman 的博客.
For an interesting history of the MessageBeep
function, see Larry Osterman's blog.
这篇关于在内部扬声器上播放声音和使用旧 xp api 功能的可能性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!