How would I go about creating multiple documents when a single file is opening in a MFC application?
We have an aggregate file format which can contain information for multiple documents. When this file is opened, I would like multiple CDocuments created for each record in the file. We already have a extended CDocManager, so I’m guessing this could be implemented by some logic in OpenDocumentFile. The question is how to pass the information about ‘I am record x of y’ back up from the CDocument class to the doc manager?
If you have several CDocument derived types that store different information, you need a seperate CMultiDocTemplate for each type, typically stored in your CApp derived class. When you call App.Initinstance you initialise each template using something like
When you open your base document, you then create and retrieve your additional documents. There are a number of places you could do this in, Serialize probably being the easiest, e.g.
The more conventional way of doing this though would be to have a single document, with multiple views for accessing the different parts of the aggregate document.