Link to home
Start Free TrialLog in
Avatar of navigator010897
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_COMMAND,MAKEWPARAM(SENDDATA,0),0);
                   
               }
               break;
         
          }

          return CallWindowProc(OldEdit,hwnd,message,wParam,lParam);

}

Here is my case statement for SENDDATA:

case SENDDATA:
               // process and send the data to the server.
          //     SendMessage(hEditBox,WM_GETTEXT,(WPARAM)200, (LPARAM)CommandBuffer);
               GetWindowText(hEditBox,CommandBuffer,200);
               ProcessCommand(sock,CommandBuffer);
               SetWindowText(hEditBox,"");
               break;
ASKER CERTIFIED SOLUTION
Avatar of mblat
mblat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of navigator010897
navigator010897

ASKER

Heck, I never thought about the WM_CHAR message.  I had tried originally doing a return 0 on the WM_KEYDOWN for VK_RETURN, but it didn't change a thing.

I did a return 0 for the WM_CHAR of it, and it worked like a charm.  Thanks!