Sign in to follow this  
Bulhakov

How to get rid of the windows default "ding" on key press?

Recommended Posts

I wrote an MFC applet in C++ in VS 7.0 that so far was all mouse operated. But now I started adding keyboard support (for moving around in an OpenGL window) and encountered a problem: Whenever I press a key (other than the arrow keys and some other "neutral" keys) I keep hearing the annoying windows default "ding.wav"! I can of course turn it off in the control panel, but I that does not really fix the problem. I'm using GetKeyState on they keys that interest me (AWSD and arrow keys). I'm guessing it's a problem with the focus staying on one of my widgets which sounds the alert when an unsopported keypress is encountered. Any ideas how to fix this?

Share this post


Link to post
Share on other sites
I don't know anything about this API, but did you try setting the focus onto a widget that supports those keypresses? (Does the window itself count as a widget?)

Share this post


Link to post
Share on other sites
Well that's the problem. I don't know how to set the focus to my GL window (it's in a Picture Control).

Just clicking on it does not seem to do it (or maybe it does, but the keystrokes still cause the windows alert).

Share this post


Link to post
Share on other sites
I can disable/remove the ding, but that will not fix this problem on other PCs.

I managed to set the focus to my GL control through:
GetDlgItem(IDC_OPENGL)->SetFocus;
but it still raises the alert when most keys are pressed. (I feel stupid for not reading about the SetFocus earlier. It's just something I never needed before.)

It's sort of annoying to run around a virtual environment and keep hearing a constant "dingdingdingding" (But only when I use the AWSD. The arrow keys don't cause this problem.)

Maybe I can use something to the likes of the KeyPreview property (but it only works for windows forms)
http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.keypreview.aspx

Any further help/advice much appreciated

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this