Share via


How to Override the Back Key for Dialog Boxes with Edit Controls

4/19/2010

To override the Back key, you use the SHCMBM_OVERRIDEKEY message, the SHMENUBARINFO structure, and the SHSendBackToFocusWindow function.

To override the Back key for dialog boxes with edit controls

  1. To override, during the handling of the Windows Embedded CE WM_INITDIALOG message, send the SHCMBM_OVERRIDEKEY message to the menu bar specified in the SHMENUBARINFO structure as follows:

    SHMENUBARINFO mbi;
    LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
                               SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
    lr = SendMessage(mbi.hwndMB, , VK_TBACK, lparam);
    // lr now contains the previous value of the key override bits.
    
  2. To send the Back key to the control with focus, call the SHSendBackToFocusWindow function during the handling of the Windows Embedded CE WM_HOTKEY message as follows:

    case WM_HOTKEY:
    {
        if(HIWORD(lParam) == VK_TBACK)
            (uMessage, wParam, lParam);
    }
    

See Also

Concepts

How to Handle the Back Key for Dialog Boxes Without Edit Controls