共用方式為


CDocTemplate::OpenDocumentFile

Opens a file specified by a path.

virtual CDocument* OpenDocumentFile(
   LPCTSTR lpszPathName,
) = 0;

virtual CDocument* OpenDocumentFile(
   LPCTSTR lpszPathName,
   BOOL bAddToMRU,
) = 0;

Parameters

  • [in] lpszPathName
    Pointer to the path of the file that contains the document 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.

Return Value

A pointer to the document whose file is named by lpszPathName; NULL if unsuccessful.

Remarks

Opens the file whose path is specified by lpszPathName. If lpszPathName is NULL, a new file that contains a document of the type associated with this template is created.

Requirements

Header: afxwin.h

See Also

Reference

CDocTemplate Class

Hierarchy Chart

CDocTemplate::CloseAllDocuments

Other Resources

CDocTemplate Members