Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

As shown in the following procedure, you can use either of two user interface messages to obtain a handle to a soft key menu.

Note:
Beginning with Windows Mobile 6.5.3, soft keys are replaced by touchable tiles on Windows Mobile Professional phones.

To obtain a handle to a soft key menu

  1. Use the SHCMBM_GETSUBMENUmessage. In the following example, a handle to the menu associated with the right soft key is returned.

    Copy Code
    // IDM_CARDVIEW_SK2_MENU is the soft key's resource ID.
    hmenu = (HMENU)SendMessage(hwndMenuBar, SHCMBM_GETSUBMENU, 0,
    IDM_CARDVIEW_SK2_MENU);
    
  2. Use the Windows Embedded CE WM_INITMENUPOPUPmessage, which is sent when a menu is about to be displayed.

A handle to the soft key bar's menu can be obtained by sending it the SHCMBM_GETMENUmessage. In the following example, a handle to the IDR_MAIN_MENUmenu will be returned.

Copy Code
HMENU hmenu = (HMENU)SendMessage(hwndMenuBar, SHCMBM_GETMENU, 0,
0);

See Also