Help with MenuHelp

This is a discussion on Help with MenuHelp within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I want to use a status bar in my program to display information about each of the menu commands ...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262

    Exclamation Help with MenuHelp

    Hi,

    I want to use a status bar in my program to display information about each of the menu commands available, and apparently MenuHelp can do this. It appears to be best used inside a WindowProc, when the WM_MENUSELECT message is processed. However, I'm not sure how the array of the menu handle/string resource ID pairs is structured. Any ideas?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    At a guess:

    From fn description:
    "Address of an array that contains pairs of string resource identifiers and menu handles.":

    eg if you have 3 menu items previously designed in a resource script and a 'descriptor' string for each menu item in a string table in a resource script:

    UINT nResID[6];
    nResID[0]=IDS_MENU1; //id of string resource 1
    nResID[1]=IDM_MENU1; //id of menu item resource 1
    nResID[2]=IDS_MENU2; //id of string resource 2
    nResID[3]=IDM_MENU2; //id of menu item resource 2
    nResID[4]=IDS_MENU3; //id of string resource 3
    nResID[5]=IDM_MENU3; //id of menu item resource 3

    And pass address of nResID as last param of fn. I'd be curious to know if that works as i've never used that fn before.

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Well, after consulting Mr. Petzold, I used the function like so:-
    Code:
    HINSTANCE gInstance; //set at startup
    HWND hStatus; //status bar window
    UINT uiMenuHelpID = 0;
    
    (in "case WM_MENUSELECT:" in WindowProc)
    MenuHelp(uMsg, wParam, lParam, NULL, gInstance, hStatus, &uiMenuHelpID);
    This works very well, I made made a string table with the IDs equal to the menu item IDs and they are displayed correctly!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21