Play sound on internal speakers and possibility to use old xp api function?

北战南征 提交于 2019-11-29 17:11:35

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).

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

For an interesting history of the MessageBeep function, see Larry Osterman's blog.

The majority of computers now don't have internal speakers, so there's nothing there to access.

The function was intentionally removed in Windows 7, according to Larry Osterman's blog; this post from the archives specifically discusses that issue. It seems that Beep.sys was removed, and the functionality of that old pseudo-device driver was changed to intentionally redirect sound to the sound card instead. The article is an interesting read from a historical standpoint.

Larry is a MS employee who worked on the new audio framework for Vista and Win7, and he's been at MS since the dinosaur days (MS-DOS at least :D) so he'd probably know. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!