Thread: Menu Not Showing

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    1

    Menu Not Showing

    The last few days I've been attempting to make a popup window with a menu outside of the WinMain class.

    Code:
    void CMFToolbar::GetQuote()
    {
    
    	InitCommonControls();
    
    	if(m_pBrowser)
    	{	
    		WNDCLASSEX wc;
    		HWND hwnd;
    		MSG Msg;
    
    		wc.cbSize		 = sizeof(WNDCLASSEX);
    		wc.style		 = 0;
    		wc.lpfnWndProc	 = (WNDPROC)WndProc;
    		wc.cbClsExtra	 = 0;
    		wc.cbWndExtra	 = 0;
    		wc.hInstance	 = GetModuleHandle(NULL);
    		wc.hIcon		 = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_MYICON));
    		wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
    		wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    		wc.lpszMenuName  = (LPCTSTR)MAKEINTRESOURCE(IDR_MYMENU);
    		wc.lpszClassName = g_szClassName;
    		wc.hIconSm		 = (HICON)LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);
    
    		if(!RegisterClassEx(&wc))
    		{
    			::MessageBox(NULL, "Window Registration Failed!", "Error!",
    				MB_ICONEXCLAMATION | MB_OK);
    		}
    
    		hwnd = CreateWindowEx(
    			WS_EX_CLIENTEDGE,
    			g_szClassName,
    			"A Menu",
    			WS_OVERLAPPEDWINDOW,
    			CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
    			NULL, NULL, GetModuleHandle(NULL), NULL);
    
    		if(hwnd == NULL)
    		{
    			::MessageBox(NULL, "Window Creation Failed!", "Error!",
    				MB_ICONEXCLAMATION | MB_OK);
    		}
    
    		::ShowWindow(hwnd, SW_SHOW);
    		::UpdateWindow(hwnd);
    
    		while(GetMessage(&Msg, NULL, 0, 0) > 0)
    		{
    			TranslateMessage(&Msg);
    			DispatchMessage(&Msg);
    		}
    
    	}
    }
    Everything works fine except for the line
    wc.lpszMenuName = (LPCTSTR)MAKEINTRESOURCE(IDR_MYMENU);

    The popup shows up, same with the icons. But the menu is missing. Anyone have any clue why this is? Thanks!

  2. #2
    Registered User kakayoma's Avatar
    Join Date
    Jul 2009
    Location
    Dallas, Texas
    Posts
    42

    Exclamation

    Did you define the menu in the .rc file?

    Vista - Something We all Love to Hate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Menu not showing
    By IdunnO in forum Windows Programming
    Replies: 5
    Last Post: 03-30-2006, 02:29 AM
  5. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM