Solved

Beeping when pressing enter in edit box.

Posted on 2002-05-28
2
621 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 100 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
Does Microsoft Office 2016 support COM/ActiveX? 3 129
Visual Studio Debugging 3 153
Delphi Mdi application Child forms get behind control 7 311
Trouble with References... 5 63
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

749 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