Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to add menu to API.

I'm using Win32 API not MFC. Now how do I add a menu to my program. I made one by CLicking Resource Script. Now what do I do. I know I have to Link it by the Window Class. but what do I put in wc.lpszMenuName? The name of the file ie. Menu.rc or the name given to the menu IDR_MENU?? Then what do I put in the CreateWindow(), if anything. Basically how do you add a menu, by using the API not MFC
Learning Win32 Api and some DirectX. How long did it take you to learn DirectX and the Windows API.

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : I'm using Win32 API not MFC. Now how do I add a menu to my program. I made one by CLicking Resource Script. Now what do I do. I know I have to Link it by the Window Class. but what do I put in wc.lpszMenuName? The name of the file ie. Menu.rc or the name given to the menu IDR_MENU?? Then what do I put in the CreateWindow(), if anything. Basically how do you add a menu, by using the API not MFCLearning Win32 Api and some DirectX. How long did it take you to learn DirectX and the Windows API.
    :
    [code][code=21C6FF][color=FFFFFF]
    1. wc.lpszMenuName = MAKEINTRESOURCE (IDR_MENU);

    2. CreateWindow (...,LoadMenu (hInstance, MAKEINTRESOURCE (IDR_MENU)),...);

    3. In window proc:
    ...
    case WM_CREATE:
    SetMenu (hWnd, LoadMenu (hInstance, MAKEINTRESOURCE (IDR_MENU)));
    return 0;
    [/color][/code][/code]

    Cheers!
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : : I'm using Win32 API not MFC. Now how do I add a menu to my program. I made one by CLicking Resource Script. Now what do I do. I know I have to Link it by the Window Class. but what do I put in wc.lpszMenuName? The name of the file ie. Menu.rc or the name given to the menu IDR_MENU?? Then what do I put in the CreateWindow(), if anything. Basically how do you add a menu, by using the API not MFCLearning Win32 Api and some DirectX. How long did it take you to learn DirectX and the Windows API.
    : :
    : [code][code=000000][color=21C6FF]
    : 1. wc.lpszMenuName = MAKEINTRESOURCE (IDR_MENU);
    :
    : 2. CreateWindow (...,LoadMenu (hInstance, MAKEINTRESOURCE (IDR_MENU)),...);
    :
    : 3. In window proc:
    : ...
    : case WM_CREATE:
    : SetMenu (hWnd, LoadMenu (hInstance, MAKEINTRESOURCE (IDR_MENU)));
    : return 0;
    : [/color][/code][/code]
    :
    : Cheers!
    :

Sign In or Register to comment.