Windows Mobile 6.5
A version of this page is also available for

This function allows your programs to request that all key presses be sent directly to the requesting application. Normally some buttons are intercepted by the operating system for its own use, but games and input - intensive applications may want access to these buttons for their own use.

BOOL AllKeys(
    BOOL bAllKeys


[in] If bAllKeys is set to TRUE, this function allows all keyboard events to be sent to the application. (This includes the softkey buttons and back button).

If it is set to FALSE, this function specifies standard keyboard event behavior. Some events including softkey buttons and the back button are not sent to the application.

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

The following C++ code illustrates how to use AllKeys. In the application that this sample is taken from, a check box is used to set AllKeys to true or false.

// process checkbox
    if (g_AllKeys == true)
        AllKeys(0);// Allow os to intercept some key / button presses 
        g_AllKeys = false;
        // set button state
        SendMessage(hwndCtl,BM_SETCHECK, BST_UNCHECKED,0);
        AllKeys(1); // Do not allow os to intercept button presses 
        g_AllKeys = true;
        //set button state
        SendMessage(hwndCtl,BM_SETCHECK, BST_CHECKED,0);

Windows MobileSmartphone for Windows Mobile 2003 and later

Community Additions