Thread: menus

  1. #1
    Registered User
    Join Date
    Oct 2003



    i'm having trouble with window menus (i'm terrible at windows API. give me directX any day ).

    what i want to do is add a menu to a window being vreated with this call:

    //Create the debug output window.
    	hOutputWnd = CreateWindowEx( WS_EX_APPWINDOW, TEXT("Ghoul Runner Demo"), TEXT("Ghoul Runner Debug Output"), 
    										WS_OVERLAPPEDWINDOW, 500,500,400,300,
    										GetDesktopWindow(), (HMENU)MAKEINTRESOURCE(IDR_DEBUG_MENU), wc.hInstance, NULL );
    	ShowWindow(hOutputWnd, SW_SHOW);
    as it stands, that code does not produce a window. If i change the HMENU parameter to NULL, it produces one (without a menu).

    i made the menu with a resource editor, and if i set it for the class menu it works fine. Am i incorrect in casting the integer resource to a HMENU?

  2. #2
    Join Date
    Jan 2002
    The menu you associate with the registered window class (ie the lpszMenuName of the WNDCLASSEX passed to RegisterClassEx) is the one that the window should be created with - you don't need to use the HMENU parameter of CreateWindowEx as you have done.

    If you need to add/remove a menu at run-time take a look at LoadMenu and other menu functions.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Oct 2003
    cheers, i still find the api a bit of a minefield.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 menus and resources help
    By firestorm in forum Windows Programming
    Replies: 24
    Last Post: 04-12-2005, 01:23 PM
  2. Creating pop up menus
    By Ti22 in forum C++ Programming
    Replies: 22
    Last Post: 01-18-2005, 09:27 PM
  3. help with menus example?
    By The Gweech in forum Windows Programming
    Replies: 3
    Last Post: 03-30-2004, 04:41 PM
  4. Menu's
    By Benzakhar in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2004, 10:13 PM
  5. adding menus at runtime
    By bennyandthejets in forum Windows Programming
    Replies: 3
    Last Post: 11-22-2002, 05:07 AM