Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic


The framework calls this method to open the named CDocument file for the application.

virtual CDocument* OpenDocumentFile(
   LPCTSTR lpszFileName 
[in] lpszFileName

The name of the file to be opened.

[in] bAddToMRU

TRUE indicates the document is one of the most recent files; FALSE indicates the document is not one of the most recent files.

A pointer to a CDocument if successful; otherwise NULL.

If a document that has that name is already open, the first frame window that contains that document will get the focus. If an application supports multiple document templates, the framework uses the file name extension to find the appropriate document template to try to load the document. If successful, the document template then creates a frame window and view for the document.

if (m_lpCmdLine[0] == _T('\0'))
   // Create a new (empty) document.
   // Open a file passed as the first command line parameter.

Header: afxwin.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.