Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing menus in MDI ( MFC)

Changing menus in MDI ( MFC)

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Like2Byte
    wrote on last edited by
    #1

    I've got a frame that's contained in a DLL and called via: extern "C" __declspec(dllexport) BOOL APIENTRY TermLoaderMode() { static CBaseMultiDocTemplate *pDocTemplate = NULL; //Derived from CMultiDocTemplate CBaseApp *pApp = (CBaseApp *)AfxGetApp(); if (pDocTemplate == NULL) { pDocTemplate = new CBaseMultiDocTemplate( IDR_LOADER_USER, RUNTIME_CLASS(CBaseDoc), RUNTIME_CLASS(CTermLoaderFrame), RUNTIME_CLASS(CTermLoaderView)); pApp->AddDocTemplate( pDocTemplate ); } return( TRUE ); } I'm trying to change out IDR_LOADER_USER with IDR_LOADER_DEV based upon user type. Users get IDR_LOADER_USER, devs get IDR_LOADER_DEV. In my view class' OnInitialUpdate(), I call the following function but it fails on ::LoadMenu. (returns NULL). Here's my menu grab function: void CTermLoaderView::ReplaceMenu(void) { HMENU hm = ((CTermLoaderView*)GetDocument())->m_hMenuDefault = ::LoadMenu( ::AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_LOADER_DEV)); if(((CTermLoaderView*)GetDocument())->m_hMenuDefault == NULL) { TRACE0("Failure to get menu object."); AfxMessageBox(_T("Failure to get menu object.")); return; } CMDIFrameWnd* frame = ((CTermLoaderView*)GetParent())->GetMDIFrame(); frame->MDISetMenu(CMenu::FromHandle(((CTermLoaderView*)GetDocument())->m_hMenuDefault), NULL); frame->DrawMenuBar(); } Help? Thanks in advance!:confused:

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups