How to skip the New Document dialog

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

–>

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

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read