次の方法で共有


How to: Obtain a Handle to a Soft Key Menu

Send Feedback

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

To obtain a handle to a soft key menu

  • 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); 
    
  • Use the Windows 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

Soft Keys | Soft Key and Menu Guidelines | How to: Create a Soft Key Bar | Soft Key Overview

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.