Making An "EDIT" Box Created With Createwindow(), Listen To VK_RETURN (ENTER) Key?
Posted on 2004-04-01
I am using Win32 API, no MFC, and on the Main Window only (ghwndAPP), I have created one Edit Box (no dialog-box) Using,
hwndeditbox=CreateWindow("EDIT",NULL,WS_VISIBLE | WS_CHILD | ES_LEFT ,240,510,316,24,ghwndApp,NULL,(HINSTANCE)GetWindowLong(ghwndApp,GWL_HINSTANCE),NULL);
I can enter text, can retrieve text etc things, using edit box messages. What right now I am doing is after the user enters the text, there is one button pressing which, the text entered goes to a txt file.
What I actually need now is in the text box even if the user presses ENTER Key, the required functionality(text going to txt file) should happen.
I am reading MSDN, using WM_KEYDOWN, WM_COMMAND etc things but not able to achieve.
Might be I am facing problem, because the TEXT Box, is not in a Dialog-Box, or might be I am not getting things right in interpreting the right Sequence of events and messages.
Please guide me, and if 10-12 lines of template code can be posted that will really great.
Thanks you for your help