need help with windows menu
Here is the relevant code... it displays the window, but no menu
WNDCLASSEX winclass;
HWND hWnd;
MSG msg;
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS / CS_OWNDC /
CS_HREDRAW / CS_VREDRAW ;
winclass.lpfnWndProc = WndProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hInstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = GetStockObject(LTGRAY_BRUSH);
winclass.lpszMenuName = NULL; // "MAINMENU";
winclass.lpszClassName = WINDOW_CLASS_NAME;
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&winclass))
return(0);
if (! (hWnd = CreateWindowEx(NULL,
WINDOW_CLASS_NAME,
"Basic Window with a Menu",
WS_OVERLAPPEDWINDOW / WS_VISIBLE,
0, 0,
400,
400, NULL,
NULL, hInstance,
NULL) ) )
return (0);
HMENU hMenu = LoadMenu(hInstance, "MAINMENU");
SetMenu(hWnd, hMenu);
As I said, this will display the window, but not the menu. I do have menu.h and menu.rc with the appropriate definitions in them.
Any help would be greatly appreciated
At this line:
Add MAKEINTRESOURCE if you are using symbolic ID''s
winclass.lpszMenuName = MAKEINTRESOURCE(MAINMENU);
I had the same problem as you and this fixed it .
Casper
Add MAKEINTRESOURCE if you are using symbolic ID''s
winclass.lpszMenuName = MAKEINTRESOURCE(MAINMENU);
I had the same problem as you and this fixed it .
Casper
...for over a thousand years the Jedi Knights have been the guardians of peace and justice..before the dark times..before the EmpireCasper..
Oooooops,
I don''t have my code in front of me but I think you put quotes around the MAINMENU.
I don''t have my code in front of me but I think you put quotes around the MAINMENU.
...for over a thousand years the Jedi Knights have been the guardians of peace and justice..before the dark times..before the EmpireCasper..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement