I remember in QBasic you could use the motherboard speaker to play some tones, and it was pretty easy too. How would i do this in C++?
Printable View
I remember in QBasic you could use the motherboard speaker to play some tones, and it was pretty easy too. How would i do this in C++?
Does that work on 2k? Because isin't direct hardware access forbidden? It compiles great, but i get some "Privledged Instruction" error :confused:
For use in the NT family, use the PlaySound api
You need to find a sound file that emulates the beep sound you want.Code:int retval;
LPSTR file = "c:\mybeep.wav"
retval = PlaySound(
file,
NULL,
SND_ASYNC) ;
Don't you need to use LPCSTR, since string literals are const char*?Quote:
Originally posted by jim mcnamara
For use in the NT family, use the PlaySound api
You need to find a sound file that emulates the beep sound you want.Code:int retval;
LPSTR file = "c:\mybeep.wav"
retval = PlaySound(
file,
NULL,
SND_ASYNC) ;
Is the motherboard speaker actually available at all under NT?
Use the MessageBeep() API, I think =).
Z.
[edit]
Dont remember if it will beep on the PC Speaker, if you have a sound card installed, but it should otherwise.
What about:
Code:
cout << "\a";