Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why Accelerator keys are not visible in menu options of the application in sdi mfc vc++ 2010
Posted
Updated 21-Jan-13 22:41pm
v2
Comments
Andy411 22-Jan-13 4:21am    
What do you mean with "menu options"? AFAIK You have to add the accelerator keys in the menu text by yourself. e.g.: "Save\tCtrl-S"
Jochen Arndt 22-Jan-13 4:32am    
Andy is right for shortcut keys.

If you refer to the underlined accelerator keys, see this MSDN blog post:
http://blogs.msdn.com/b/oldnewthing/archive/2005/05/03/414317.aspx
Andy411 22-Jan-13 4:55am    
Good hint, Jochen!

1 solution

Defining accelerator keys and menu item accelerators are two separate tasks.

Accelerator keys are implemented in the resource file as:

IDR_ACCELERATORS ACCELERATORS 
BEGIN
    "A",            ID_EDIT_SELECT_ALL,     VIRTKEY, CONTROL, NOINVERT
    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL, NOINVERT
    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL, NOINVERT
    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL, NOINVERT
    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL, NOINVERT
    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
END


Menu items are implemented in the resource file as:

IDR_MAINMENU MENU DISCARDABLE
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit",                       ID_APP_EXIT
    END
END


Note the use of the ampersand ("&") in the menu definitions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900