navigator010897
asked on
Beeping when pressing enter in edit box.
Hi,
This is driving ME NUTZ.
I have subclassed the control so I can press the enter key and send a message to the main window to process the text in the window. But, every time I press Enter it dings at me (like an error beep). I have stepped thru it all, and when I press enter, the message is being sent, the text is retrieved, and the edit box is cleared. But I have NO CLUE as to why this beeping is going on.
Anyone, please...
Here is my subclass function:
LRESULT CALLBACK EditProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
if (wParam == VK_RETURN)
{
SendMessage(MainWnd,WM_COM MAND,MAKEW PARAM(SEND DATA,0),0) ;
}
break;
}
return CallWindowProc(OldEdit,hwn d,message, wParam,lPa ram);
}
Here is my case statement for SENDDATA:
case SENDDATA:
// process and send the data to the server.
// SendMessage(hEditBox,WM_GE TTEXT,(WPA RAM)200, (LPARAM)CommandBuffer);
GetWindowText(hEditBox,Com mandBuffer ,200);
ProcessCommand(sock,Comman dBuffer);
SetWindowText(hEditBox,"") ;
break;
This is driving ME NUTZ.
I have subclassed the control so I can press the enter key and send a message to the main window to process the text in the window. But, every time I press Enter it dings at me (like an error beep). I have stepped thru it all, and when I press enter, the message is being sent, the text is retrieved, and the edit box is cleared. But I have NO CLUE as to why this beeping is going on.
Anyone, please...
Here is my subclass function:
LRESULT CALLBACK EditProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
if (wParam == VK_RETURN)
{
SendMessage(MainWnd,WM_COM
}
break;
}
return CallWindowProc(OldEdit,hwn
}
Here is my case statement for SENDDATA:
case SENDDATA:
// process and send the data to the server.
// SendMessage(hEditBox,WM_GE
GetWindowText(hEditBox,Com
ProcessCommand(sock,Comman
SetWindowText(hEditBox,"")
break;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did a return 0 for the WM_CHAR of it, and it worked like a charm. Thanks!