Loading...

Opening / Saving multiple types of documents in MFC MDI applications

View: 2441    Dowload: 0   Comment: 0   Post by: hanhga   Category: C / C++ / MFC   Fields: Computers - Technology

What you need to do

All the altered codes are marked (as //Babak) so you can find them easily and just implement them exactly in your own project. Here is a summary of what you need to do:

  • Derive a class from CDocManager (here named CMultDocManager)
    • Override DoPromptFileName
    • Override OnFileNew
    • You will need to copy _AfxAppendFilterSuffix (with a slight change) from mfc/src/ docmgr.cpp (bad programming style)
  • Derive a class from CMultiDocTemplate (here named CMultMultiDocTemplate)
    (this is so your program can recognize multiple file types seperated by a semicolon
  • Override GetDocString
  • Override MatchDocType

(for the last two steps, just add the files MultDocManager.h/cpp and MultMultiDocTemplate.h/cpp to your project)

  • Set m_pDocManager of your main application class (the one that is derived from CWinApp) to new CmultDocManager
  • Open the .rc file of the project and make copies of IDR_...TYPE (for various file types)
  • Go through all the projcet files and everytime IDR_...TYPE is used, also use the new ones you made
  • Override DoSave in your main document class (the one that is derived from CDocument)

Opening / Saving multiple types of documents in MFC MDI applications

This is a simple visual C++ 6.0 multiple document (MDI) project that allows opening / saving multiple types of documents. Normally, when you start an MDI project, you are allowed to associate one file type (i.e. extension) with your project. If you want to be able to open / save more that one type, you need to change your program a bit (Figure 1). MyFirstProject is a simple empty project that handles multiple types.

Posted on 16-04-2014 

Comment:

To comment you must be logged in members.

Files with category

  • Sound Player in Visual Studio C++ .NET

    Sound Player in Visual Studio C++ .NET

    View: 3    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    This sound player project use the libZPlay from http://libzplay.sourceforge.net . Methods are called from library libzplay.dll with [InteropServices::DllImport("")]. The use of the library is relatively easy.

  • Quiz Management System in C++

    Quiz Management System in C++

    View: 7    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    Hello World...!!! Though I am not an expert programmer but today i want to share my little knowledge of C/C++ programming by sharing this simple Quiz Management System with you people. I hope this may help some students in their mini...

  • General Quiz

    General Quiz

    View: 79    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    This is one of my first WPF projects, and it may be used as a template for a quiz test. The code can be improved but I think its useful for the ones who don't have experience with WPF.

  • Calculating Average and Grade

    Calculating Average and Grade

    View: 26    Download: 2   Comment: 0

    Category: C / C++ / MFC     Fields: none

    Calculating Average and Grade is a small program in order to find the result of students in the class.

  • H.K.M.S SUPREME TYRES

    H.K.M.S SUPREME TYRES

    View: 12    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    H.K.M.S SUPREME TYRES --------------------- Goals: --------- * Brand Master * Size Master * User Master * Customer Master * Purchase Form * Order Form * Bill Form Software is as follows: ------------------------------ * Microsoft Visual Studio 2013 *...

  • Cronpp - a C++ library for CRON expressions

    Cronpp - a C++ library for CRON expressions

    View: 12    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: Other

    A CRON expression is a string composed of six fields (in some implementation seven), separated by a whites space, representing a time schedule. CRON expressions are used in various job schedulers (such as the Linux job scheduler, the Quartz...

  • Departmental store management system

    Departmental store management system

    View: 19    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    This is a simple project on departmental store management system developed in c++ programming language . This project helps to keep all the information details of the items available in departmental store and maintains the stock and prints the bill....

  • Volume of a Cone in C

    Volume of a Cone in C

    View: 23    Download: 0   Comment: 0

    Category: C / C++ / MFC     Fields: none

    Code Features: 1. Find the Volume of a cone 2. Find the value of other properties of the cone 3. Teach user how to compute the volume of the cone manually Thanks to following for the code: John Carlo C. Nañoz, Dondon Bagasbas, Gabby Peñones

 
File suggestion for you
Loading...
File top downloads
Loading...
Loading...
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd