How to: Override the Back Key for Dialog Boxes with Edit Controls
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
To override, during the handling of the Windows 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, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); // lr now contains the previous value of the key override bits.
To send the Back key to the control with focus, call the SHSendBackToFocusWindow function during the handling of the Windows CE WM_HOTKEY message as follows:
case WM_HOTKEY: { if(HIWORD(lParam) == VK_TBACK) SHSendBackToFocusWindow(uMessage, wParam, lParam); }
See Also
How to: Handle the Back Key for Dialog Boxes Without Edit Controls
Send Feedback on this topic to the authors