?
Solved

Beeping when pressing enter in edit box.

Posted on 2002-05-28
2
Medium Priority
?
623 Views
Last Modified: 2013-12-03
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;
0
Comment
Question by:navigator010897
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
mblat earned 400 total points
ID: 7040909
Try to overwrite WM_CHAR message for VK_RETURN and DON'T pass it to default window's handler...

Hope it helps...
0
 
LVL 1

Author Comment

by:navigator010897
ID: 7040934
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!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question