SECDocManager: An MFC Application Document Manager
To allow the CApplication object to use the SECComDoc document type, you must modify the document manager. Normally, given a choice of several different document template types, the document manager simply asks the user which one is required in response to the OnFileNew() command. The ComDoc system adds the ability to decide in advance which document type should be invoked. The mechanism that displays the standard document choice dialog is extended for this purpose.
A string contained in the document resources identifies each separate document type registered in an application. This string contains the name of the document type, the file extension used, the document title text, and other information. By using SECDocManager and an overloaded version of OnFileNew(), it’s possible to call up a file by using the document name stored in the template string. The prototype of this function is shown below.
virtual CDocument *OnFileNew(LPCSTR DocIdent,
UINT nOpCode,UINT nSubCode=0, DWORD dwData=NULL,
SECComDoc *parent=NULL);
The first parameter, DocIdent, should be the document’s template string name. The other parameters are the op-code, sub-code, and data for the new document’s initialization procedure and a pointer to the document that is to act as parent.
The following string is the document template string from the Objective Chart document used in the MultiGrph example:
\nGraph\nGraph\nGraph documents\n.gph\nGraph.Document\nGraph Document
Using this template, a graph document may be invoked using the “Graph” name as the DocIdent.






