Share via


CDocTemplate::MatchDocType

virtual Confidence MatchDocType( LPCTSTR lpszPathName**, CDocument*&** rpDocMatch );

virtual Confidence MatchDocType( LPCTSTR lpszPathName**, DWORD** dwFileType**, CDocument*&** rpDocMatch );

Return Value

A value from the Confidence enumeration, which is defined as follows:

enum Confidence
{
        noAttempt,
        maybeAttemptForeign,
        maybeAttemptNative,
        yesAttemptForeign,
        yesAttemptNative,
        yesAlreadyOpen
};

Parameters

lpszPathName

Pathname of the file whose type is to be determined.

rpDocMatch

Pointer to a document that is assigned the matching document, if the file specified by lpszPathName is already open.

dwFileType

The type of the document (Macintosh only).

Remarks

Use this function to determine the type of document template to use for opening a file. If your application supports multiple file types, for example, you can use this function to determine which of the available document templates is appropriate for a given file by calling MatchDocType for each template in turn, and choosing a template according to the confidence value returned.

If the file specified by lpszPathName is already open, this function returns CDocTemplate::yesAlreadyOpen and copies the file’s Cdocument object into the object at rpDocMatch.

If the file is not open but the extension in lpszPathName matches the extension specified by CDocTemplate::filterExt (or the Macintosh file type matches), this function returns CDocTemplate::yesAttemptNative and sets rpDocMatch to NULL. For more information on CDocTemplate::filterExt, see CDocTemplate::GetDocString.

If neither case is true, the function returns CDocTemplate::yesAttemptForeign.

The default implementation does not return CDocTemplate::maybeAttemptForeign or CDocTemplate::maybeAttemptNative. Override this function to implement type-matching logic appropriate to your application, perhaps using these two values from the Confidence enumeration.

CDocTemplate OverviewClass MembersHierarchy Chart

See Also   CDocTemplate::GetDocString