Solved

Child windows not subordinated to the frame?

Posted on 1998-10-06
11
270 Views
Last Modified: 2013-11-20
Hi!

I would like to implement an application with several child windows, who behave like mainframes...
Compare to Outlook, where Outlook itself is a MainFrame with a menu and a treecontrol and a listbox. And every child of the frame (a single mail) is not bound to the mainframe...

What classes do I need? A MDIFrameWnd with FrameWnd as childs?  

Who can help me?

Thank you
0
Comment
Question by:Knallar
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 1

Expert Comment

by:Fargo
Comment Utility
Yes you have to use the Multiple Document Interface (MDI) in your application. You can specify that, when you create your project with the MFC App Wizard. After doing so, the framework creates for you 3 classes connected to the MDI model: a document derived from CDocument, a main frame derifed from CMDIFrameWnd, and child frame class derived from the CMDIChildWnd. This is the answer to your question about the child windows. They SHOULD be derived from CMDIChildWnd, because this class works in conjunction with the MDICLIENT object, which is a member of the main frame window. And one thing more: in order to use the Document/View architecture, you have to create a CMultiDocTemplate object in your App's InitInstanse(). But this is just another thingie the AppWizard of VC++, that does for you.
I will recomend to create an MDI project with the AppWizard (just start it and read carefully and check everithing that's connected to the MDI). Then I will propose you to take a look at what MSDN says about the MDI architecture and what MFC classes are involved.

I hope, I was help :)
0
 
LVL 1

Expert Comment

by:Fargo
Comment Utility
And by the way, the Outlook child windows are NOT child windows to the MainFrame, but they are separate applications. Take a close look to the taskbar, and you'll see that every new mail window is registered there, and if you have PView you'll find them as standalone applications. You can do that easy if you start the other applications (which represent the false childs) from the main window.
0
 

Author Comment

by:Knallar
Comment Utility
Hmmmm fargo...
I didn't want MDIChilds...
I need to have childwindows, which can be placed anywhere on the desktop not only inside the CMDIFrameWnd.
If I use the common MFC-MDI-architecture, I get the case you described above.
But then my childs are inside the Frame and I'm not able to place them anywhere I like.
0
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
For outlook style UI, try this page
http://www.codeguru.com/advancedui/index.shtml

The articles that probably interest you are
#1 An Outlook98 bar-like control - Iuri Apollonio (1998/08/01)
#2 Outlook 98' style UI - Kirk Stowell (1998/08/22)

Article #1 creates a splitter in the mainframe (actually a derived class of CSplitterWnd) and then a custom control in the LHS

Article #2 is probably more directly relevant to your question as I undertand it
0
 
LVL 1

Expert Comment

by:Fargo
Comment Utility
Hmmmm knallar...
Did you read my comment? You want to create some pop-up child windows...
Let me think...you can do something over the window style of the child windows. But see what the MS documentation states about the window styles (and let me notice that this is a part of the A-B-C of the Windows programming):

WS_CHILD :
Creates a child window. Cannot be used with the WS_POPUP style.
 
WS_POPUPWINDOW:
Creates a pop-up window with the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the Control menu visible.

.and to be more clear, I include the description of what a pop-up window is:

pop-up window :
A special type of overlapped window typically used for dialog boxes, message boxes, and other temporary windows that appear outside an application's main window.

So, you CANNOT create a CHILD window that is POP_UP also
PLEASE READ MY PREVIOUS COMMENT.
I'm sorry that I was not helpful, but as I stated already you can start your "child" windows as standalone applications as your favourite Outlook does.

Sincerly yours
Fargo
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

by:Fargo
Comment Utility
Hmmmm knallar...
Did you read my comment? You want to create some pop-up child windows...
Let me think...you can do something over the window style of the child windows. But see what the MS documentation states about the window styles (and let me notice that this is a part of the A-B-C of the Windows programming):

WS_CHILD :
Creates a child window. Cannot be used with the WS_POPUP style.
 
WS_POPUPWINDOW:
Creates a pop-up window with the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the Control menu visible.

.and to be more clear, I include the description of what a pop-up window is:

pop-up window :
A special type of overlapped window typically used for dialog boxes, message boxes, and other temporary windows that appear outside an application's main window.

So, you CANNOT create a CHILD window that is POP_UP also!
PLEASE READ MY PREVIOUS COMMENT.
I'm sorry that I was not helpful, but as I stated already you can start your "child" windows as standalone applications as your favourite Outlook does.

Sincerly yours
Fargo
0
 
LVL 3

Expert Comment

by:plaroche
Comment Utility
To have child windows not subordinated to the frame you don't really have to start other applications.  It can be done also by making you popup child windows children of the desktop window.

You retrieve the desktop window with GetDesktopWindow(), use that pointer as a parent to the child window you will create.  Beware not to store the pointer across messages, it may become invalid. You can safely store the HWND though.

Doing this will also make a new icon for the window on the taskbar. And it will also make the windows standalone.
0
 

Author Comment

by:Knallar
Comment Utility
O.K... sounds logical...

Now... simply tell me what special classes of the mfc I have to use...
A CFrameWnd and as the new "child" also a CFrameWnd with it's parent set to the desktopwindow?
0
 
LVL 1

Expert Comment

by:Fargo
Comment Utility
Knallar, do you want me to go there (whereever you are) and develop the prog for you?
If so, just send me your address (country, state, street...etc.) and I'll be there in a minute...
0
 
LVL 3

Accepted Solution

by:
plaroche earned 50 total points
Comment Utility
Use a simple CWnd derived class, or even a dialog or anything you wish. It all depends on what you need to do.

As for Outlook, let's say you wanted the same behavior well you could create a childframe and let have it float with the parent as desktopwindow
0
 
LVL 1

Expert Comment

by:Fargo
Comment Utility
...And no special classes. You guessed it would be CFrameWnd window with the styles and actions plaroche proposed you. I don't understand, why you reject answers that seem logical to you?!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 47
Named range not carried over 10 57
haveThree challenge 22 100
firstChar challenge 13 83
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

772 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

13 Experts available now in Live!

Get 1:1 Help Now