

When menu item is clicked, then a message is sent with that number.

IDM_ABOUT is a number defined in resource file #define IDM_ABOUT 101 (or it might be a different number). In the above example wmEvent is not used, don't worry about it for now. You can also make dialog boxes.Įach menu item or dialog box button has an identification number, this number is passed through WPARAM wParam. Open the resource nodes until you see "Menu". You should see a window called "Resource view". In solution explorer, double-click the file with *.rc extension.

It can be done programmatically as you have shown, or it can be done with resource editor. Thanks for any answers provided, and it would be appreicated if someone could point me in the direction of a good current as possible win32 api C++ tutorial.
WIN32 APPLICATION WIZARD VISUAL STUDIO 2017 CODE
If you need to see more code of my program it's just a non blank C++ Win32 Project in VS2013 How is it they add the file and help menu bars, as well as the about and exit items in the menubars without using the createmenu() and such? WHat does IDM_ABOUT and IDM_EXIT mean? They have those in the menus, but does just putting them in the switch statement add them to the menubars? What is wmId and wmEvent and why is the switch on wmId? What is actually adding those items to the menu bar? Return DefWindowProc(hWnd, message, wParam, lParam) But all they do is have a switch like this in WndProc: switch (message)ĭialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About) I see to add items to the menu bar tutorials have mentioned to use something like: hMenubar = CreateMenu() ĪppendMenuW(hMenu, MF_STRING, IDM_FILE_NEW, L"&New") ĪppendMenuW(hMenu, MF_STRING, IDM_FILE_OPEN, L"&Open") ĪppendMenuW(hMenu, MF_SEPARATOR, 0, NULL) ĪppendMenuW(hMenu, MF_STRING, IDM_FILE_QUIT, L"&Quit") ĪppendMenuW(hMenubar, MF_POPUP, (UINT_PTR)hMenu, L"&File") īut in the default project for C++ Desktop in VS2013 has a File and Help menubar and inside they have Exit and About. I'm trying to learn some basic win32 api.
