Hello, I want to sublcass an Edit control so that I can catch when the user
presses the enter key
here's my subclass window proc, EditControlProc is the normal Edit window
proc.
LRESULT CALLBACK InputEditSubProc( HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
char* cmd;
switch( uMsg)
{
case WM_KEYDOWN:
switch (wParam)
{
case VK_RETURN:
cmd = new char[768];
SendMessage( hWnd, WM_GETTEXT, 768, (LPARAM) cmd);
// Processing
SendMessage( hWnd, WM_SETTEXT, 0, (LPARAM) "");
delete cmd;
break;
default:
return CallWindowProc( EditControlProc, hWnd, uMsg, wParam,
lParam);
}
break;
default:
return CallWindowProc( EditControlProc, hWnd, uMsg, wParam, lParam);
}
return 0;
}
This works fine, my code is executed properly, but, whatever I return, I
still have a windows ding when I press enter (which looks like the default
edit behavior), that is not supposed to happen if I return 0 so I'm at a
loss here...
Also, is there a good and simple way to retrieve the window proc for the
EDIT control ? what I do at the moment is retrieve it when I create my first
Edit control, but this makes me check if I already have it every time I
create one. I'd like something I could run once on the application init.
Thanks