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

  • The hard facts on SaaS adoption in over 80,000 enterprises: Public vs. private companies Mid-market vs. large enterprise GoogleApps, Office365, Salesforce & more Why security is a growing concern Fill out the form to download the full cloud adoption report.

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

Most Popular Programming Stories

More for Developers

RSS Feeds