I am trying to learn some basic win32 api. I see to add items to the menu tutorials that are mentioned in order to use something like:
hMenubar = CreateMenu();
hMenu = CreateMenu();
AppendMenuW(hMenu, MF_STRING, IDM_FILE_NEW, L"&New");
AppendMenuW(hMenu, MF_STRING, IDM_FILE_OPEN, L"&Open");
AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL);
AppendMenuW(hMenu, MF_STRING, IDM_FILE_QUIT, L"&Quit");
AppendMenuW(hMenubar, MF_POPUP, (UINT_PTR)hMenu, L"&File");
But in the default project for C ++ Desktop in VS2013 there is a File and Help menu, and inside they have an Exit and an About. But all they have is a switch in WndProc:
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
I have a few questions. How do they add files and help menu panels as well as menu items and exits without using createmenu (), etc.? What does IDM_ABOUT and IDM_EXIT mean? Do they have those in the menu, but just put them in a switch statement, adding them to the menu? What are wmId and wmEvent and why is the switch enabled wmId? What actually adds these items to the menu bar?
, ++ Win32 VS2013
, , - , , win32 api ++.