• Advertisement
Sign in to follow this  

(c++ win32) detecting keypress in 'edit' box?

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I've got an 'edit' created using CreateWindow, and I was wondering how I would go about detecting if the user has pressed the 'enter/return' key. I've checked and there is no default messages that are sent when the key is pressed. (eg commands like EN_CHANGE) So how would I go about it? Thanks

Share this post


Link to post
Share on other sites
Advertisement
NM_RETURN looks promising, but I am having a bit of trouble finding a decent example of it,

I tried subclassing, which I'd prefer not use because of the extra complexity.


Also when I hit enter in the edit control, it makes a default beep sound, I really don't want that, is there someway of preventing that? The styles I'm using is WS_VISIBLE|WS_CHILD.

thx

Share this post


Link to post
Share on other sites
There is no way to stop that using styles - you'll need to subclass the edit.

As for examples of NM_RETURN - it works just like any other notification. See the documentation for WM_NOTIFY (which NM_RETURN comes through). WM_NOTIFY works nearly the same as WM_COMMAND.

Share this post


Link to post
Share on other sites
Quote:
Original post by Colin Jeanne
There is no way to stop that using styles - you'll need to subclass the edit.


I set up the sub class, but I am unsure of how to stop the beep when the enter key is pressed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement