-1

win32 api:

So when one of my dialog boxes has focus, I press 'a' and then do some stuff in the WM_KEYDOWN message, and then it gives the bell/warning sound. Is there someway to suppress this?

Joel
  • 15,166
  • 16
  • 39
  • 31
  • please add your window procedure code. I'm not really sure, but does it work as you want if you don't `return DefWindowProc(...)`? – LeleDumbo Jul 28 '11 at 04:17
  • Did you ever consider that Windows plays those sounds for purposes of accessibility for users who may be visual impaired? It's also an auditory hint for "that doesn't do what you want". – selbie Jul 28 '11 at 08:45

1 Answers1

1

It seems I needed to add a:

HANDLE_MSG(hWnd, WM_GETDLGCODE, Dlg_YOURPROC_OnGetDlgCode);

to the dialog and then in the Dlg_YOURPROC_OnGetDlgCode you need to return DLGC_WANTCHARS:

UINT Dlg_YOURPROC_OnGetDlgCode(HWND hwnd, LPMSG lpmsg) 
{
    return DLGC_WANTCHARS;
}

Not sure why I was downvoted for my question, I seem to have provided enough information for an answer...

Joel
  • 15,166
  • 16
  • 39
  • 31