WM_GETDLGCODE and DLGC_WANTMESSAGE

This is a discussion on WM_GETDLGCODE and DLGC_WANTMESSAGE within the Windows Programming forums, part of the Platform Specific Boards category; Salute, I have a little problem with tabbing through my own created controls. All works fine, except the tabbing. If ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    66

    [solved] - WM_GETDLGCODE and DLGC_WANTMESSAGE

    Salute,

    I have a little problem with tabbing through my own created controls.

    All works fine, except the tabbing.
    If I tab to the first control the VK_ENTER and VK_RETURN were correct handled, but I can't tab forward, means it stays on the first control and waits for handling the message.

    So, how could I tell the GETDLGCODE to tab forward if VK_TAB is pressed ?

    Here's an extract of my controls MessageProc ...

    Code:
    		case WM_KEYDOWN:
    			if (wParam == VK_RETURN) {
    				IsHover = false;
    				hbmp    = bmpHover;
    				::InvalidateRect (hWndCtrl, NULL, TRUE);
    				::UpdateWindow (hWndCtrl);
    				::PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(ctrlID, 0), reinterpret_cast<long> (hWndCtrl));
    			}
    			break;
    
    		case WM_KEYUP:
    			if (wParam == VK_SPACE) {
    				IsHover = false;
    				hbmp    = bmpHover;
    				::InvalidateRect (hWndCtrl, NULL, TRUE);
    				::UpdateWindow (hWndCtrl);
    				::PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(ctrlID, 0), reinterpret_cast<long> (hWndCtrl));
    			}
    			break;
    
    		case WM_GETDLGCODE:
    			return DLGC_WANTMESSAGE;
    If I remove case WM_GETDLGCODE: from the code only the WM_KEYUP (VK_SPACE) is working and the WM_KEYDOWN is ignored ...

    Thanx for attention ...

    EDIT:
    WM_KEYDOWN and WM_KEYUP isn't necessary.
    [SOLVED]
    Code:
    		case WM_GETDLGCODE:
    			if (lParam) {
    				pmsg = reinterpret_cast<LPMSG> (lParam);
    				if (pmsg->wParam == VK_RETURN || pmsg->wParam == VK_SPACE) {
    					IsHover = false;
    					hbmp    = bmpHover;
    					::InvalidateRect (hWndCtrl, NULL, TRUE);
    					::UpdateWindow (hWndCtrl);
    					::PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(ctrlID, 0), reinterpret_cast<long> (hWndCtrl));
    					return DLGC_WANTMESSAGE;
    				}
    			}
    			break;
    [/SOLVED]




    Greetz
    Greenhorn
    Last edited by Greenhorn__; 07-23-2008 at 12:30 PM.

Popular pages Recent additions subscribe to a feed

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