Why VK_RETURN not working???

This is a discussion on Why VK_RETURN not working??? within the Windows Programming forums, part of the Platform Specific Boards category; This is my code Code: WNDPROC oldEditProc; INT_PTR CALLBACK newEditProc(HWND hEdit, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) ...

  1. #1
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    308

    Why VK_RETURN not working???

    This is my code
    Code:
    WNDPROC oldEditProc;
    
    INT_PTR CALLBACK newEditProc(HWND hEdit, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    	switch (uMsg)
    	{
    	case WM_KEYDOWN:
    		{
    			SendMessage(GetParent(hEdit), uMsg, wParam, lParam);
    			break;
    		}
    	}
    	return CallWindowProc(oldEditProc, hEdit, uMsg, wParam, lParam);
    }
    
    //...
    
    oldEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT1), GWLP_WNDPROC, (LONG)newEditProc);
    
    // ...
    
    case WM_KEYDOWN:
    		{
    			switch (wParam)
    			{
    			case VK_RETURN:
    				{
    					MessageBox(hDlg, 0, 0, 0); // I can't see this
    					break;
    				}
    			}
    			return 0;
    		}
    
    //...
    
    DialogBoxParam(someInstance, MAKEINTRESOURCE(IDD_DIALOG1), somehwndParent, DlgProc, NULL);
    I can't see the messagebox, any ideas???
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Does the edit have the ES_WANTRETURN and ES_MULTILINE styles?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    308
    Nop, is a single line edit control
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  4. #4
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    I believe that you need to use WM_GETDLGCODE and return DLGC_WANTCHARS, allowing you to receive a WM_CHAR message.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    I don't think edits without the ES_MULTILINE and ES_WANTRETURN send VK_RETURN msgs.

    from MSDN

    "ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box’s default pushbutton. This style has no effect on a single-line edit control. "
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function not working
    By sloopy in forum C Programming
    Replies: 31
    Last Post: 11-12-2005, 07:08 PM
  2. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 07:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM

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