Thread: Disabling beeps from return key

  1. #1
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630

    Disabling beeps from return key

    I was wondering how I would keep my prog from making that noise when I press the enter key.

    Info:
    Im using an edit control that has been subclassed so that I can trap WM_KEYDOWN messages (namely VK_RETURN ;-)).

    I thought that just returning 0 from handling would do it but it didnt Thanx in advance.

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Might it be a WM_CHAR message? Did you use translate message? Or maybe a WM_KEYUP?

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I've heard of this being a problem but I've never experienced it before. Could you post your callback function (the subclassed one not your main one)?.

    I also have a simple way of controlling this. You can turn off your speakers

  4. #4
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    All im processing in the subclassed WndProc handles WM_KEYDOWN like this:

    Code:
    static bool    bKeys[256];
    switch(Msg)
    {    case WM_KEYDOWN:
          {    bKeys[wParam] = true;
                if(bKeys[VK_RETURN] == true)
                {    SendMessage(hParent,MW_USER+1,0,0);
                      return(0);
                }
                else
                {    return Def(hWnd,Msg,wParam,lParam);
                }
                break;
           }
           case WM_KEYUP:
           {   bKeys[wParam] = false;
                return Def(hWnd,Msg,wParam,lParam);
           }
           default:
                return Def(hWnd,Msg,wParam,lParam);
    }
    Def is the WNDPROC returned from GetWindowLong btw. Im using WM_USER+1 for custom app things. Thanks in advance

  5. #5
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Figured it out by playing around, just needed to trap WM_CHAR messages.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  4. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM