Ignatz
asked on
Editbox trap Enter key
I am not using MFC.
I have a 1 line editbox as part of a dialog. I would like to trap and process the Enter key instead of having the default button processed. I have subclassed the editbox control and receive all messages except VK_RETURN. I use spy++, which shows the editbox receiving a WM_KEYDOWN with wParam of VK_RETURN, but my processing loop never sees this!
Any Suggestions? Thank You, Ignatz
I have a 1 line editbox as part of a dialog. I would like to trap and process the Enter key instead of having the default button processed. I have subclassed the editbox control and receive all messages except VK_RETURN. I use spy++, which shows the editbox receiving a WM_KEYDOWN with wParam of VK_RETURN, but my processing loop never sees this!
Any Suggestions? Thank You, Ignatz
can you give a sample of your message processing loop?
ASKER
Here is a stripped down version:
LRESULT CALLBACK MyEditBoxProc(HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam)
{
switch (iMsg) {
case WM_KEYDOWN:
vtest_msg("my.out","have key <%d>",wParam);
switch (wParam) {
case VK_RETURN:
test_msg("pjc.out","have return");
return 0;
} // switch on wParam if WM_KEYDOWN
break;
} // switch on message
return (CallWindowProc((WNDPROC)G etWindowLo ng(hwnd,GW L_USERDATA ),hwnd,iMs g,wParam,l Param));
} // MyEditBoxProc
vtest_msg() and test_msg() just dump to a file.
Thanks, Ignatz
LRESULT CALLBACK MyEditBoxProc(HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam)
{
switch (iMsg) {
case WM_KEYDOWN:
vtest_msg("my.out","have key <%d>",wParam);
switch (wParam) {
case VK_RETURN:
test_msg("pjc.out","have return");
return 0;
} // switch on wParam if WM_KEYDOWN
break;
} // switch on message
return (CallWindowProc((WNDPROC)G
} // MyEditBoxProc
vtest_msg() and test_msg() just dump to a file.
Thanks, Ignatz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, Thank You.
(I had to use DLGC_WANTALLKEYS. DLGC_WANTRETURN was undefined.)
(I had to use DLGC_WANTALLKEYS. DLGC_WANTRETURN was undefined.)