Take MDI Child Window out of the MDI frame Window in an MFC application

103 views Asked by At

I have an MDI legacy MFC application. Inside the MDI Frame Window, I have MDI Child Windows. Is there a way I can take these MDI Child Windows out of the MDI Frame Window? I am asking that to see if I want to see different child windows in different monitors. Right now, all the Child Windows are constrained inside the MDI Frame Window.

2

There are 2 answers

1
Remy Lebeau On BEST ANSWER

An MDI child window cannot be removed from the MDI frame window. You will have to move the MDI child's content onto a separate free-floating window, and then you can position that window as desired. For instance, put the MDI child's content inside of some container window that is a child of/docked to the MDI child window, and then you can simply reparent/redock that container onto the floating window when needed.

0
Constantine Georgiou On

There is an option for "multiple top-level documents" in AppWizzard, which is not actually exactly like what MS-Office looks and feels, but with some code changes it can be somewhat improved. You will have to create a new test-application and modify yours having that one as an example/guide. Create the test-application first, to check how it fares across different monitors and if it can be tailored to your needs and liking. Not sure if they are separate processes.

Otherwise SDI is the recommended option currently (since Windows 95 actually!) and this definitely works across different monitors. They are separate processes though, and if you have to share some data between your documents you will need to employ techniques like file mapping.

If converting to SDI is too much work, you can consider keeping MDI and modify the way it opens the documents. For example, when opening a new document is requested and there is at least one document open, you can spawn a new instance of the application with the document's filename as an argument in the command-line. And the MDI child should better be initially maximized, of course. A band-aid solution, but maybe one to consider, if you feel that converting to SDI cannot be justified cost-wise.