How to skip the New Document dialog

–>

There is a simple way how to go round the dialog which appears
when your app uses more than one document template and you
click the ‘new’ button. You can open any document directly.
Here is a small example of function which opens all documents from your
document template at once.

void CMyApp::OnOpenAllTypesOfDocuments()
{
  POSITION pos = GetFirstDocTemplatePosition();
  CDocTemplate* pTemplate = GetNextDocTemplate(pos);
  pTemplate->OpenDocumentFile(NULL);  // creates the first document

  pTemplate = GetNextDocTemplate(pos);
  pTemplate->OpenDocumentFile(NULL);  // creates the second document

  // etc...
}

More by Author

Must Read