Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Beeping when pressing enter in edit box.

Posted on 2002-05-28
2
Medium Priority
?
625 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

596 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