PDA

View Full Version : Add Menu???



joey
11-20-2001, 11:46 PM
This is my code:


// Create The Window
if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window
"JOEY", // Class Name
title, // Window Title
dwStyle | // Defined Window Style
WS_CLIPSIBLINGS | // Required Window Style
WS_CLIPCHILDREN, // Required Window Style
0, 0, // Window Position
WindowRect.right-WindowRect.left, // Calculate Window Width
WindowRect.bottom-WindowRect.top, // Calculate Window Height
NULL, // No Parent Window
NULL, // No Menu
hInstance, // Instance
NULL))) // Dont Pass Anything To WM_CREATE
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}

let say i want to add a menu bar to the window with simple FILE,EDIT,VIEW,WINDOW,HELP etc....
How do i edit my code (NULL,// No Menu) above??
if i have a parent window, how do i change(NULL,// No Parent Window) coding above??\


Any help is appreciated....
Thanks for reading through the code....

mikael_aronsson
11-21-2001, 04:36 AM
Hi !

Not much OpenGL there is it ;o)

You have to create the menu with the CreateMenu() functions and friends, then you get a HMENU handle you can pass on to the function when you create the window.

Mikael

ARES
11-21-2001, 10:21 AM
If you are using MSV you can use

LoadMenu( NULL, MAKEINTRESOURCE(IDR_MENU) );

where IDR_MENU is a menu in your resource.