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. Changed CMDIChildWnd to CMDIChildWndEx: does not show anything inside the frame

Changed CMDIChildWnd to CMDIChildWndEx: does not show anything inside the frame

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
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.
  • D Offline
    D Offline
    Dansveen
    wrote on last edited by
    #1

    Hi all I have an MFC application that works perfectly with the CMDIChildWnd class, the frame is loaded and a splitterwnd is shown. I needed to create a new MFC application that uses the ribbon as the interface, and for that the only change I made was that my classes inherited from CMDIChildWndEx. The two MFC applications should work with CMDIChildWndEx, but the old application does not show anything in the frames, it does not show errors, exceptions, it does not show inside the window. I already tried changing the style, forcing the frame size, changing the spliterwnd but nothing worked. See the LoadFrame code:

    void CMyFrame::ActivateFrame(int nCmdShow)
    {
    if (m_pMDIFrame && m_pMDIFrame->SendMessage(WM_IS_ENABLE_MDI_TAB))
    {
    LONG style = ::GetWindowLong(GetSafeHwnd(), GWL_STYLE) | WS_MAXIMIZE;
    style &= ~WS_BORDER & ~WS_THICKFRAME & ~WS_DLGFRAME & ~WS_CAPTION;
    ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, style);
    style = ::GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE);
    style &= ~WS_EX_CLIENTEDGE;
    ::SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, style);
    ShowWindow(SW_SHOWMAXIMIZED);
    return;
    }

    if (m\_bInsideMDIFrame)
    {
    	CMDIChildWndEx::ActivateFrame(nCmdShow);
    	return;
    }
    
    long style = ::GetWindowLong(GetSafeHwnd(), GWL\_STYLE);
    style &= ~WS\_MINIMIZEBOX & ~WS\_MAXIMIZEBOX;
    ::SetWindowLong(GetSafeHwnd(), GWL\_STYLE, style);
    style = ::GetWindowLong(GetSafeHwnd(), GWL\_EXSTYLE);
    style &= ~WS\_EX\_CLIENTEDGE;
    ::SetWindowLong(GetSafeHwnd(), GWL\_EXSTYLE, style);
    
    SetWindowPos(NULL, 0, 0, 0, 0, SWP\_DRAWFRAME | SWP\_NOZORDER | SWP\_NOACTIVATE | SWP\_NOSIZE); 
    
    CFrameWnd::ActivateFrame(SW\_SHOWNOACTIVATE);
    

    }

    BOOL CMyFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle,
    CWnd* pParentWnd, CCreateContext* pContext)
    {
    if (g_globalVariables.GetParentWnd() == NULL)
    {
    if (m_bInsideMDIFrame)
    return CMDIChildWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);

    	return CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);
    }
    
    ASSERT(m\_nIDHelp == 0 || m\_nIDHelp == nIDResource);
    
    m\_bInsideMDIFrame = FALSE;
    
    m\_nIDHelp = nIDResource;    // ID for help context (+HID\_BASE\_RESOURCE)
    
    CString strFullString;
    if (strFullString.LoadString(nIDResource))
    	AfxExtractSubString(m\_strTitle, strFullString, 0);    // first sub-string
    
    VERIFY(AfxDeferRegisterClass(AFX\_WNDFRAMEORVIEW\_REG));
    
    dwDefaultStyle = WS\_CHILD | WS\_VISIBLE | WS\_CLIPSIBLINGS;
    
    // attempt to create the window
    LPCTSTR lpszClass = GetIconWndClas
    
    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