I've written a C++ program in Visual Studio 2008 using OpenGL, GLUT, and GLUI. I wish to add a winAPI menu to the top of the window (not the popup ones). I'm wondering how I should go about in doing this? Thanks!
I've written a C++ program in Visual Studio 2008 using OpenGL, GLUT, and GLUI. I wish to add a winAPI menu to the top of the window (not the popup ones). I'm wondering how I should go about in doing this? Thanks!
what do you mean by not the pop up ones?
Like I want the ones that appear on top of the window instead of the right click or middle click menus.
lol ok
1- create a resource for the menu, goto resource view and create a menu into the project. Editing the menu is simple
2- make sure resource.h is included in where you are creating the window
3- where you create and register the class add the name of the menu resource ( for example where iv bolded )
Code :m_hInst = instance; // Register your window "class" with Windows WNDCLASS wc; //wc.cbSize = sizeof(WNDCLASSEX); wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = 0; wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hIcon = 0; wc.hInstance = instance; wc.lpfnWndProc = wndproc; wc.lpszClassName = L"name"; wc.lpszMenuName = MAKEINTRESOURCE([B]IDR_MENU1[/B]); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; if ( 0 == RegisterClass( &wc ) ) throw std::runtime_error( "RegisterClass failed" );
4- in callback do
Code :switch ( msg ) { case WM_COMMAND: { wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case **menu button id**: { // code here for button } break; } } }
Thank you, that's just what I needed![]()