turbobanana turbobanana - 22 days ago 6
C++ Question

MFC Applicaton: How to add a set of controls to an single document application?

It's my first MFC application and I'm quite new to Visual Studio, so I can't understand exactly what I need to start with. I've already read many forums and MSDN articles, but almost all I see is how to use controls in dialog-based applications or how to draw or load a document in SDI applications. But my task seems to combine features of both types, so I can't even decide whether I choose the right type of MFCApp .

Here is the simplified version of my task.
I have to write an application in VS 2015 using MFC which must:

  • have a common Main menu as for the document application;

    • have something like pane of fixed size which contains TextEdit and Button controls and some control able to display the image (in
      there must be more different controls, but it's not important for
      the question);

    • the rest part of the area must be used to display the modified image as the result of clicking the Button on the pane;

    • the image displayed in the control on the pane is loaded from the file chosen in File->Open dialog;

    • the image displayed on ButtonClick event is taken from the image control on the pane and is mixed with the text from textEdit

    • the changed image can be saved to a file via File->Save dialog.

Here is the scheme of the task


  1. I understand that dialog-based application allow to add the controls
    to the form easily, but in this case I can't understand how to deal
    with main menu and loading and saving the document.

  2. Also I found an example of adding a pane to the
    MainFrm of a document-based application but then I can't find the
    way to add any control to the added pane.

Maybe someone can tell me which type of MFC application I should choose and how to deal with the problems I have when choosing this or that type. Thank you!

Answer Source

When you want toolbars and menus or ribbons you should use an SDI application.

You have a view area that is your working image/surface. all buttons controls and commands are above the surface in a toolbar and menu or in a ribbon.

As an alternative you can choose SDI with a form view. In this case you have an application similar to a dialog application but again with menu and toolbar or a ribbon.

The view can take more controls and works like a dialog.

MDI is in some way "out of date". But still possible... most applications today are SDI applications...