Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bind enter key to a edit control

Status
Not open for further replies.

iranor

Programmer
Jun 17, 2004
174
CA
So I have that RichEdit box created with the CreateWindow method. I want to bind the enter key on it, so when someone press Enter, I want to execute a method called ProcessCommand. I tried to put the WM_KEYDOWN event on my main wnd proc, but it just works as long as the focus is not on the edit control :( (I can change to a standard edit box if it makes it easier)


HWND hTypeZone;

LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LoadLibrary("RICHED20.DLL");

switch (uMsg)
{
case WM_CREATE:
hTypeZone = CreateWindow("RichEdit20A", "", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_WANTRETURN | WS_VSCROLL | ES_AUTOHSCROLL, 5, 410, 610, 24, hwnd, NULL, hinst, NULL);
 
Doesn't the inclusion of ES_WANTRETURN in the CreateWindow call mean that returns go directly to the edit control? Have you tried removing that option?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top