We help IT Professionals succeed at work.

Creating mulitple Forms within and SDI without the frame

graber asked
Medium Priority
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.
Watch Question

mahesh1402IT Professional
Top Expert 2005

>>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:

cs.style = 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);

        cs.style = 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;
        cs.style &= ~WS_BORDER;
        return CFormView::PreCreateWindow(cs);

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

AndyAinscowFreelance programmer / Consultant

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.


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?
Freelance programmer / Consultant
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
AndyAinscowFreelance programmer / Consultant

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.