How to add menu to API. - Programmers Heaven

Howdy, Stranger!

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

Categories

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.