#1
  1. No Profile Picture
    Designer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Netherlands
    Posts
    104
    Rep Power
    13

    Borland C++ 5 Popup menu


    Lo I want to create a popup menu on left click I got the left click I also got the hmenu defined my problem is with the getsubmenu wich returns NULL

    Here is the initialisation code:

    Code:
      switch (iMsg) {
        case WM_CREATE :
        		SetInternational();
             hMenu = LoadMenu (hInst, MAKEINTRESOURCE(MENU_1) );
    //         if (LoadMenu (hInst, MAKEINTRESOURCE(MENU_1)) == NULL) { MessageBox (hwnd, "Doet het niet :(", szAppName, MB_ICONINFORMATION | MB_OK); }
             hMenu = GetSubMenu(hMenu, 0);
             if (GetSubMenu(hMenu, 0) == NULL) { MessageBox (hwnd, "It doesn't work :(", szAppName, MB_ICONINFORMATION | MB_OK); }
             return 0  switch (iMsg) {
        case WM_CREATE :
        		SetInternational();
             hMenu = LoadMenu (hInst, MAKEINTRESOURCE(MENU_1) );
    //         if (LoadMenu (hInst, MAKEINTRESOURCE(MENU_1)) == NULL) { MessageBox (hwnd, "It doesn't work :(", szAppName, MB_ICONINFORMATION | MB_OK); }
             hMenu = GetSubMenu(hMenu, 0);
             if (GetSubMenu(hMenu, 0) == NULL) { MessageBox (hwnd, "It doesn't work:(", szAppName, MB_ICONINFORMATION | MB_OK); }
             return 0;

    My problem is the second if It returns NULL instead of the menu handler... Any takers?

    Using (like I said) Borland 5.0
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    This may be a dumb thing to ask, but exactly how deep is your popup menu from the main menu? The reason I'm asking is because I see that you're calling GetSubMenu twice (which means you're trying to access a third level menu). Also, after this line:
    hMenu = GetSubMenu(hMenu, 0);

    Can you confirm that hMenu is not null at this point?

IMN logo majestic logo threadwatch logo seochat tools logo