Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


convert SDI to MDI - any shortcut

arvind17arvind17 Member Posts: 62
I have an application which is in the SDI format. Is there any simple format to convert the project to MDI.

Now, I have to create a new project MDI and paste all the necessary codes there fr the SDI project. Of course I find that a lenghly process and I would like to know if there is any simple way to do that. I understand that in MDI my appl will have to create Child Frame windows in addition to the Main Frame window.



  • stoberstober Member Posts: 9,765 ✭✭✭
    I read about this some time ago but can't find it now. So I created two test program -- an MFC SDI program and an MFC MDI program. Using the MDI program an the example, it wasn't very hard to convert the SDI to MDI.

    You have to create a new CChildFrame-based class, convert CMainFrame class from SDI to MDI, and change the .cpp (based on CWinApp) InitInstance() to create MDI template instead of SDI.

    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame

    //// NEW CODE BELOW ////
    // create main MDI Frame window
    CMainFrame* pMainFrame = new CMainFrame;
    if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
    return FALSE;
    m_pMainWnd = pMainFrame;
    /// end of new code /////

Sign In or Register to comment.