Beep and MessageBeep
-
Dear all; I wanna implement a application. 1.play sound from buzzer on motherboard in win xp, win 7, win 8. 2.play wav from sound card in win xp, win 7, win 8. The function 2 is OK, but the function 1 failed. (A)use Beep function i. works on win xp. ii. failed on win 7, the sound just play from the sound card. iii. failed on win 8, the sound just play from the sound card. (B)use MessageBeep function i. Did not test on win xp. ii.failed on win 7, the sound just play from the sound card. iii.Did not test on win 8. Somebody says the Beep.sys was different between win xp and win 7. I don't want to replace the Beep.sys on win 7. How can I implement this application? Thanks for your help. Victor
-
Dear all; I wanna implement a application. 1.play sound from buzzer on motherboard in win xp, win 7, win 8. 2.play wav from sound card in win xp, win 7, win 8. The function 2 is OK, but the function 1 failed. (A)use Beep function i. works on win xp. ii. failed on win 7, the sound just play from the sound card. iii. failed on win 8, the sound just play from the sound card. (B)use MessageBeep function i. Did not test on win xp. ii.failed on win 7, the sound just play from the sound card. iii.Did not test on win 8. Somebody says the Beep.sys was different between win xp and win 7. I don't want to replace the Beep.sys on win 7. How can I implement this application? Thanks for your help. Victor
See the Beep function[^] in the MSDN. It describes why the sound is generated by the sound card with Windows 7 and later. Modern PC systems did not have the timer chip to generate the sound for the internal speaker. Without the timer chip, there is no need for an internal speaker. Some system manufacturers has therefore added a buzzer to their systems. But this is not true for all systems. So you should use the
MessageBeep()
function which decides how to play the sound. Your application may also check for the Windows version and use theBeep()
function whith XP. But you can not rely on the existance of an internal speaker or buzzer. -
See the Beep function[^] in the MSDN. It describes why the sound is generated by the sound card with Windows 7 and later. Modern PC systems did not have the timer chip to generate the sound for the internal speaker. Without the timer chip, there is no need for an internal speaker. Some system manufacturers has therefore added a buzzer to their systems. But this is not true for all systems. So you should use the
MessageBeep()
function which decides how to play the sound. Your application may also check for the Windows version and use theBeep()
function whith XP. But you can not rely on the existance of an internal speaker or buzzer. -
But you can not rely on the existance of an internal speaker or buzzer
I guess that every PC has something that buzz when he had no RAM inserted in he's RAM slot ... or not ?You are probably right about the buzzer.
-
See the Beep function[^] in the MSDN. It describes why the sound is generated by the sound card with Windows 7 and later. Modern PC systems did not have the timer chip to generate the sound for the internal speaker. Without the timer chip, there is no need for an internal speaker. Some system manufacturers has therefore added a buzzer to their systems. But this is not true for all systems. So you should use the
MessageBeep()
function which decides how to play the sound. Your application may also check for the Windows version and use theBeep()
function whith XP. But you can not rely on the existance of an internal speaker or buzzer.Dear Jochen: My computer install two operation system, win xp and win 7 use MessageBeep() 1.XP-Did not test. 2.Win 7- The sound play from sound card, not buzzer. use Beep() 1.XP-The sound from buzzer. 2.Win 7- The sound play from sound card, not buzzer. So I ensure the buzzer exist. Anything else method? Thank for your help, Victor
-
Dear Jochen: My computer install two operation system, win xp and win 7 use MessageBeep() 1.XP-Did not test. 2.Win 7- The sound play from sound card, not buzzer. use Beep() 1.XP-The sound from buzzer. 2.Win 7- The sound play from sound card, not buzzer. So I ensure the buzzer exist. Anything else method? Thank for your help, Victor
The simplest solution to use the buzzer/speaker with XP and the soundcard with Vista and later is:
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion >= 6)
::MessageBeep(-1);
else
::Beep(1000, 1000);If you want to use the buzzer with Windows Vista and later, you must replace the beep.sys driver (which is a bad option). There may be alternatives by accessing the buzzer by low level code. But these will probably not work with 64-bit Windows versions. If have found BEEPx at http://www.waldbauer.com/tmp/reference.php[^].
-
Dear all; I wanna implement a application. 1.play sound from buzzer on motherboard in win xp, win 7, win 8. 2.play wav from sound card in win xp, win 7, win 8. The function 2 is OK, but the function 1 failed. (A)use Beep function i. works on win xp. ii. failed on win 7, the sound just play from the sound card. iii. failed on win 8, the sound just play from the sound card. (B)use MessageBeep function i. Did not test on win xp. ii.failed on win 7, the sound just play from the sound card. iii.Did not test on win 8. Somebody says the Beep.sys was different between win xp and win 7. I don't want to replace the Beep.sys on win 7. How can I implement this application? Thanks for your help. Victor
-
Dear «_Superman_»: I want to play sound from buzzer on computer, not from sound card. Thank for your help, Victor.