How to Obtain a Handle to a Soft Key Menu

Windows Mobile 6.5
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.

Bb416407.note(en-us,MSDN.10).gifNote:
Beginning with Windows Mobile 6.5.3, soft keys are replaced by touchable tiles on Windows Mobile Professional phones.

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

    // 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_INITMENUPOPUP message, 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_GETMENU message. In the following example, a handle to the IDR_MAIN_MENU menu will be returned.

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

Community Additions

Show: