?
Solved

How to check ENTER was pressed in edit box?

Posted on 1998-02-03
2
Medium Priority
?
364 Views
Last Modified: 2013-12-03
How to determine when user press ENTER "in" single line edit box ?:

control = CreateWindow( "EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
        5, 5, 495, 200, hwnd, (HMENU)ID_OUTBOX, hInst, NULL );

This:
   case WM_KEYDOWN:
         nVirtKey = (int) wParam;    
         if( nVirtKey == VK_RETURN && control == GetFocus() )

doesn't work.

This:
   case WM_COMMAND:
         wNotifyCode = HIWORD(wParam);
         wID = LOWORD(wParam);
         if( wID==ID_OUTBOX && wNotifyCode==EN_CHANGE )

is not what I want, I want ONLY ENTER, something like "WM_NEWLINE" or
"EN_CARRIAGERETURN".

                  Please help,
                              Robert
0
Comment
Question by:beton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 1410853
Normally the RETURN is "wired" into the default button on the parent form (i.e. the OK button). If you want to receive the RETURN button in your EDIT control, create it with the ES_WANTRETURN flag in the resource file or click the "Want return" in the VC++ DevStudio dialog editor.
0
 

Author Comment

by:beton
ID: 1410854
This style has no effect on a single-line edit control.
And I'm not interesting in MFC solution, in fact I found
way out, I use NewProcEdit function as control message quelle
handler and do "case WM_KEYDOWN : if (wParam == VK_RETURN)"
OldProcEdit = (WNDPROC) SetWindowLong (chatin, GWL_WNDPROC,
                  (LONG) NewProcEdit);
ant it works great !
But thx very much :) ES_WANTRETURN is that I didn't know.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question