Creating mulitple Forms within and SDI without the frame

Posted on 2006-04-05
Last Modified: 2013-11-20
I have been banging my head over how to create multiple forms or form views in an SDI.  The forms will be linked together like a flow chart.  These forms or form types will carry information that will be played back in the order that they were created. I need the sdi to keep track of the work area, ie scroll out to accomidate the number of form/form types.  I have been looking at ways to overwrite the CFrameWindow or CFormView class to create a no border frame so that visible links can be created in the work space as well.
Thanks yet again guys.
Question by:graber
    LVL 22

    Expert Comment

    >>have been looking at ways to overwrite the CFrameWindow or CFormView class to create a no border frame

    First in your FRAME, override the PreCreateWindow and set: = WS_POPUP;
    cs.dwExStyle = 0;

    after you have called the CFrameWnd::PreCreateWindow.

    Example code :

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
            BOOL retval;
            // TODO: Modify the Window class or styles here by modifying
            //  the CREATESTRUCT cs
            retval = CFrameWnd::PreCreateWindow(cs);

   = WS_POPUP;
            cs.dwExStyle = 0;
            return retval;

    Then in your View you also need to override the PreCreateWindow.

    Example code :

    BOOL CBrowserView::PreCreateWindow(CREATESTRUCT& cs)
            // TODO: Modify the Window class or styles here by modifying
            //  the CREATESTRUCT cs

            cs.dwExStyle = 0;
   &= ~WS_BORDER;
            return CFormView::PreCreateWindow(cs);

    Doing both of these things will remove the SDI border.  Hope this helps...

    LVL 43

    Expert Comment

    For me your question is very unclear as to what you really want.
    If you remove the border the user would find it difficult to resize (and move) the window of your app.

    Do you want a form as in a dialog (edit, text, list....) or do you just want to display different 'pictures' as you also talk of flow chart ?

    Create dialogs in the resource editor and display them to fill the child area of the view, hide them when not required.  
    The OnPaint of the view can be used to 'draw' in the view.

    Visible links in work space ?  Do you mean having a window for example like explorer where one part shows items (files, folders...), selecting an item changes the display in the other part ?

    One of the steps in the wizard to create a new app is the option to have it explorer style - that creates a splitter window with two views, one can then modify the views as you require.
    LVL 2

    Author Comment

    In one sense the application will look like rational roses. In one view your are able to see the relationship between various entities graphically.  Resizing a dragging are not an issue.  At this juncture I need to create about 5 diffrent classes of dialog boxes or forms that will be parented by an SDI/MDI frame work.  The frame work will keep track of how they are linked together but the forms will be classes of container types to hold data.  You also see the same basic type of frame work in Microsoft Access when you look at the links of a database.

    Mahesh why am I altering the CMainFrame class precreate?
    LVL 43

    Accepted Solution

    in .h file

    CMyDlg1* m_pDlg1;
    CMyDlg2* m_pDlg2;
    these are pointers to each of the dialogs you want to have displayed

    in .cpp file
    constructor of view - initialise each dialog pointer to NULL

    in OnInitialUpdate
    m_pDlg1 = new CMyDlg1(this);
    m_pDlg1->Create(IDD_MYDLG1, this);
    ...  same for each dialog.

    Now use
    m_pDlg1->ShowWindow(SW_SHOW);  //Show dialog1
    m_pDlg2->ShowWindow(SW_HIDE);  //hide dialog 2
    this displays the dialog you require.

    In the OnSize of the view
    m_pDlg1->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);  //cx, cy are the size of the client area - makes the dialog fill the client area
    LVL 43

    Expert Comment

    In the dialog editor make certain the dialogs have no border, is are child (NOT popup), visible set to false to reduce flickering when they are created should it be a problem.
    You may need to set the size of the dialog when you create them - I am not certain if the OnSize will come before or after the OnInitialUpdate

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now