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

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • With the average hard drive now averaging one terabyte in size, the fallout from the explosion of user-created data has become an overwhelming volume of potential evidence that law-enforcement and corporate investigators spend countless hours examining. Join Us and SANS' Rob Lee for our 45-minute webinar, A Triage and Collection Strategy for Time-Sensitive Investigations, will demonstrate how to: Identify the folders and files that often contain key insights Reduce the time spent sifting through content by …

Most Popular Programming Stories

More for Developers

RSS Feeds