What should I use to replace the WinAPI Beep() function?

Posted by Jon Cage on Stack Overflow See other posts from Stack Overflow or by Jon Cage
Published on 2010-06-15T10:50:46Z Indexed on 2010/06/15 10:52 UTC
Read the original article Hit count: 181

Filed under:
|
|
|
|

I've got a Visual C++/CLI app which uses beeps to signify good and bad results (used when the user can't see the screen).

Currently I use low pitched beeps for bad results and high pitched beeps for good results:

if( goodResult == true )
{
    Beep(1000, 40);
}
else
{
    Beep(2000, 20);
}

This works okay on my Vista laptop, but I've tried it on other laptops and some seem to play the sounds for less time (they sound more like clicks than beeps) or the sound doesn't play at all.

So I have two questions here:

  1. Is there a more reliable beep function?
  2. Is there a (simple) way I can play a short .wav file or something similar instead (preferred solution).

© Stack Overflow or respective owner

Related posts about wpf

Related posts about Windows