Why wont my function properly make a menu bar in my application?

I have been trying to create a menu bar in my windows application but the bar will not show, can anyone help me find whats wrong with my code? I'm sure i don't completely understand the concept..

Here is the function that creates my window class and "tries" to create a menu bar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* This function will create a Window Class and a Window Menu */
WNDCLASSEX CreateWindowClass (WNDCLASSEX windowclass, HINSTANCE handle)
{
    HMENU windowmenu;                                           /* A handle to the menu */
    MENUITEMINFO MenuItemInfo;                                  /* Structure variable that contains info about a menu item */
    windowmenu = CreatePopupMenu ();                                 /* Creating a menu */
    unsigned int File;                                          /* Declaring a Menu Item name */

    MenuItemInfo.cbSize = sizeof (MENUITEMINFO);             /* Filling out members of the menu item info structure  */  
    MenuItemInfo.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID            
                         | MIIM_CHECKMARKS | MIIM_STRING;
    MenuItemInfo.fType = MFT_MENUBREAK | MFT_OWNERDRAW | MFT_STRING;
    MenuItemInfo.fState = MFS_ENABLED;                              
    MenuItemInfo.wID = File;                                        
    MenuItemInfo.hbmpChecked = NULL;                                

    InsertMenuItem (windowmenu, File, false, &MenuItemInfo); /*inserting a menu item in menu bar*/

    windowclass.cbSize = sizeof (WNDCLASSEX);                   
    windowclass.hInstance = handle;                             
    windowclass.lpszClassName = "Main Class";                   
    windowclass.lpszMenuName = MAKEINTRESOURCE (File);       /*Assigning the menu bar to window class */   
    windowclass.lpfnWndProc = WindowProcedure;                  

    windowclass.style = CS_DBLCLKS;                             
    windowclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);       
    windowclass.hIconSm = NULL;                                 
    windowclass.hCursor = LoadCursor (NULL, IDC_CROSS);         
    windowclass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 3); 

    windowclass.cbClsExtra = 0;                                 
    windowclass.cbWndExtra = 0;            

}


Last edited on
wndclass.lpszMenuName specifies a menu in resource file. Not a dynamically created one.
Last edited on
Topic archived. No new replies allowed.