Zero or One Document Interface (ZODI)

Environment: VC6

What's This?

This article describes how to create a single-document application using a multi-document interface. You may have zero or one documents at a time.

I've written a CMultiDocTemplate-derived class, CZoDocTemplate. It overrides the OpenDocumentFile function. OpenDocumentFile works like CSingleDocTemplate; it reinitializes a created document instead of creating one more document. If there is no opened document, a new document is created as in an MDI case. If you create several document templates, you will have a maximum of one document per template.

To Create Your Own ZODI Application

  1. Create an MDI application with AppWizard.
  2. Add ZoDocTemplate.h and ZoDocTemplate.cpp in your project, named <your app>.
  3. Include ZoDocTemplate.h in <your app>.cpp.
  4. In the InitInstance function, replace:
        CMultiDocTemplate* pDocTemplate;
        pDocTemplate = new CMultiDocTemplate(...);
    
    with
        CZoDocTemplate* pDocTemplate;
        pDocTemplate = new CZoDocTemplate(...);
    

Similar Article

Here is a similar article, MSDI. In it, I present another, simpler, way of MSDI implementation. In the MSDI example, when opening a new document, the created one is destroyed and a new one is created. In ZODI, the existing document is reinitialized as in the SDI case.

Downloads

Download demo project - 21 Kb
Download simple exe - 8 Kb
Download source - 4 Kb


Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As mobile devices have pushed their way into the enterprise, they have brought cloud apps along with them. This app explosion means account passwords are multiplying, which exposes corporate data and leads to help desk calls from frustrated users. This paper will discover how IT can improve user productivity, gain visibility and control over SaaS and mobile apps, and stop password sprawl. Download this white paper to learn: How you can leverage your existing AD to manage app access. Key capabilities to …

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds