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: September 19, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT In response to the rising number of data breaches and the regulatory and legal impact that can occur as a result of these incidents, leading analysts at Forrester Research have developed five important design principles that will help security professionals reduce their attack surface and mitigate vulnerabilities. Check out this upcoming eSeminar and join Chris Sherman of Forrester Research to learn how to deal with the influx of new device …

  • Live Event Date: September 10, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild". This loop of continuous delivery and continuous feedback is …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds