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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.