troubleshooting Question

Inserting a CMenu in to main menu bar

Avatar of Moo-Juice
Moo-Juice asked on
System Programming
6 Comments1 Solution2105 ViewsLast Modified:
Hi All,

I am using MFC in Visual Studio 2008.  I have a CMDIFrameWndEx which has a CMFCMenuBar as the app-wizard provides.

I also have a menu resource, IDR_SCENE.

At runtime, I want to add the IDR_SCENE menu dynamically to the main menu bar.  Declaring the menu in my class:

CMenu m_sceneMenu;

I then try and insert it like this during creation:

::InsertMenu(pParentWnd->GetMenuBar().GetHMenu(), 0, MF_BYPOSITION | MF_POPUP, reinterpret_cast<UINT_PTR>((HMENU)(*m_sceneMenu.GetSubMenu(0))), NULL);

But, I never, ever see it.  No errors occur.  I have done some searching and this appears to be the way to do it.

Can anyone assist?

Thanks in advance

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros