Do something on keypress

I've made a form, that you need to click a button to submit(guess a word actually).
Your word is written in an editbox. I was wondering how could I submit it automatically with press of VK_RETURN?

I've tried WM_KEYDOWN and SendMessage() when enter is pressed, but that doesn't work...

How do I fix that?
Where is it being submitted to ?
Can u show some code for a clearer picture ?
Submitted is perhaps a wrong word, actualy it reads the box content and compares it to the solution, but that is done when a button is pressed...the enter key *should* have the same functionality, but when the box is selected there is only sound for invalid key pressed...
So, there is an editbox1 where the user inputs a value and u want to process that value through the edit box and not by using a button1 right ?

By default, pressing enter while in an editbox (single line) will activate the next button_x in the tabstop. Pressing enter in a multiline editbox will just add a new line. Neither will process the value directly. To have the editbox mimic the behavior of a button1 one option is to subclass the editbox and capture the WM_CHAR message (or WM_KEYDOWN).
Last edited on
Topic archived. No new replies allowed.