I'm trying to use the MessageBeep
API to play a sound, but no sound plays.
MessageBeep(MB_ICONINFORMATION);
MessageBeep(MB_ICONASTERISK);
MessageBeep(MB_ICONEXCLAMATION);
MessageBeep(MB_ICONERROR);
MessageBeep(MB_ICONHAND);
MessageBeep(MB_ICONINFORMATION);
MessageBeep(MB_ICONQUESTION);
MessageBeep(MB_ICONSTOP);
MessageBeep(MB_ICONWARNING);
MessageBeep(MB_OK);
the function (which returns a BOOL
) returns true
Yes there is a "Default" sound set in the Sounds applet of the Control Panel
Beep
function is not relevant here) Applications are not allowed to take exclusive control of my default (and only) sound device:
Windows does not attempt to play any sound; you can see no "output levels" in the Volume Mixer:
What am I missing?
procedure TForm4.Button1Click(Sender: TObject);
begin
MessageBox(0, 'About to play sounds', 'TestApp', MB_OK);
MessageBeep(MB_ICONINFORMATION);
MessageBeep(MB_ICONASTERISK);
MessageBeep(MB_ICONEXCLAMATION);
MessageBeep(MB_ICONERROR);
MessageBeep(MB_ICONHAND);
MessageBeep(MB_ICONINFORMATION);
MessageBeep(MB_ICONQUESTION);
MessageBeep(MB_ICONSTOP);
MessageBeep(MB_ICONWARNING);
MessageBeep(MB_OK);
MessageBeep($ffffffff);
MessageBox(0, 'After playing sounds', 'TestApp', MB_OK);
end;
Tested on:
Larry Osterman: What's up with the Beep driver in Windows 7?
The Windows Beep
function was re-engineered starting with Windows 7 to no longer use the PC speaker, and now uses the default sound device.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.