A version of this page is also available for

Windows Embedded CE 6.0 R3


This function assigns a window to receive a particular hardware button's key-press messages.


BOOL SHSetAppKeyWndAssoc(
  BYTE bVk,
  HWND hwnd


  • bVk
    [in] Key code for the hardware button.
  • hwnd
    [in] Handle to the window that will receive the messages.


The bVk values are virtual key codes. Use VK_APP1 through VK_APP6. The number of hardware keys available and physical key locations vary according to the destination device.

If hwnd is set to NULL, the association between the window and the navigation control is removed.

Return Value

This function returns TRUE if it is successful and FALSE if it fails. For more information about a failure, call GetLastError.


Header aygshell.h
Library aygshell.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2000 and later

See Also

Other Resources