This article describes how to create a single-document application using multi-document interface. You may have zero or one document at a time.
I've written a
CMultiDocTemplate - derived class
CZoDocTemplate. It overrides
OpenDocumentFile works like
CSingleDocTemplate one. It reinitializes created document instead of creating one more document. If there is no opened document, new document is created like in MDI case. If you create several document templates, you will have maximum one document per each template.
To create your own ZODI application
- Create MDI application with AppWizard.
- Add ZoDocTemplate.h & ZoDocTemplate.cpp in your project, named <your app>.
- Include ZoDocTemplate.h in <your app>.cpp.
InitInstance function, replace
pDocTemplate = new CMultiDocTemplate(...);
pDocTemplate = new CZoDocTemplate(...);
Here is a similar article: Single View in MultiDoc-Application. I present another more simpler way of "Single View in MultiDoc-Application" implementation. In ZODI, the existing document is reinitialized like in SDI case.
Date posted: February 18, 2004.