When a window is disabled via EnableWindow(hwnd, FALSE), and the user clicks on it, then the "Default Beep" sound gets played. I don't want this to happen. How can I disable this behavior programatically for the current Process in C/C++ with Win32 code?
The beep is generated by the default window processing of the WM_SETCURSOR message.
From docs for WM_SETCURSOR:
If the low-order word of the lParam parameter is HTERROR and the high-order word of lParam specifies that one of the mouse buttons is pressed, DefWindowProc calls the MessageBeep function.
To prevent the beep, your window procedure should handle WM_SETCURSOR and not call DefWindowProc under those conditions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With