subclassed edit control trouble

This is a discussion on subclassed edit control trouble within the Windows Programming forums, part of the Platform Specific Boards category; hi I have a subclassed edit control the proc is like this Code: if (uMsg==WM_KEYDOWN && LOWORD(wParam)==VK_RETURN) { if (SendMessage(hWnd, ...

  1. #1
    ENF
    ENF is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    12

    subclassed edit control trouble

    hi I have a subclassed edit control the proc is like this
    Code:
    if (uMsg==WM_KEYDOWN && LOWORD(wParam)==VK_RETURN)
    			{
    				if (SendMessage(hWnd, WM_GETTEXT, 100, (LPARAM)Buffer))
    		   				{
    					 	 SendMessage(hWnd, EM_SETSEL, 0, -1);
    					 	 SendMessage(hWnd, WM_CLEAR, 0, 0);
    						}
    					 return 0;
    			}
    
    	return CallWindowProc((void *)OrigonalEditProc, hWnd, uMsg, wParam, lParam);
    This is just suposed to clear the edit box when enter is pressed (and later some processing of that text) but each time enter is pressed it makes the default sound even though VK_RETURN message isn't passed to the default edit procedure. so How do I get rid of this sound each time enter is pressed.

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    ES_WANTRETURN or ES_MULTILINE should do the trick. Either create the edit control with one of these styles, or change it later on.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    23
    Add something like this:

    Code:
          case  WM_CHAR:
             switch (wParam)  {
                case VK_RETURN:
                   return (0);
             }
             break;
    Or do it all in WM_CHAR.

    Delf

  4. #4
    ENF
    ENF is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    12
    ES_MULTILINE did it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 06:58 AM
  2. can't disable ctrl-V on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-06-2008, 07:37 AM
  3. Controlling an edit control
    By master5001 in forum Windows Programming
    Replies: 2
    Last Post: 10-16-2001, 03:08 PM
  4. Edit control
    By The15th in forum Windows Programming
    Replies: 2
    Last Post: 09-25-2001, 12:36 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21