Hi!
I want to make an application in Microsoft visual c++ that plays a sound when I press a button on my keyboard. Anybody know how to do this? I really want to know!
Thanks in advance!
Oh and btw I've already managed to make a web browser!
C++ sound on keypress?
#include %26lt;iostream%26gt;
#include %26lt;windows.h%26gt; // WinApi header
using namespace std;
int main()
{
Beep(523,500); // 523 hertz (C5) for 500 milliseconds
Beep(587,500);
Beep(659,500);
Beep(698,500);
Beep(784,500);
cin.get(); // wait
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment