Compartilhar via


How to Obtain a Handle to a Soft Key Menu

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_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);

See Also

Tasks

How to Create a Soft Key Bar

Other Resources

Soft Key and Menu Guidelines