I made an edit control able to accept data when somebody would click "Enter". I used subclassing to do that. It worked almost perfectly. However after clicking "Enter" the system plays "Error" sound every time. I tried to use ES_MULTILINE and ES_AUTOVSCROLL to bypass it but it helped partially. Now after clicking "Enter" there's no sound, but in the textbox appears useless "Enter" character, that is impossible to delete. How to bypass the system sound? Or delete "Enter" character from that textbox (SetWindowText(handle, "") doesn't help).
You do not need the ES_MULTILINE
, ES_AUTOVSCROLL
or ES_WANTRETURN
style flags.
To stop a single-line edit control from beeping on VK_RETURN
you need to handle the WM_CHAR
message for that control and return 0 for VK_RETURN
without calling the default window procedure, which has to be called for all other keys.