Share via


CFileDialog::SetTemplate

Sets the dialog box template for the CFileDialog object.

void SetTemplate(
   UINT nWin3ID,
   UINT nWin4ID 
);
void SetTemplate(
   LPCTSTR lpWin3ID,
   LPCTSTR lpWin4ID 
);

Parameters

  • [in] nWin3ID
    Contains the ID number of the template resource for the non-Explorer CFileDialog object. This template is only used on Windows NT 3.51 or when the OFN_EXPLORER style is not present.

  • [in] nWin4ID
    Contains the ID number of the template resource for the Explorer CFileDialog object. This template is used only on Windows NT 4.0 and later versions, Windows 95 and later versions, or when the OFN_EXPLORER style is present.

  • [in] lpWin3ID
    Contains the name of the template resource for the non-Explorer CFileDialog object. This template is only used on Windows NT 3.51 or when the OFN_EXPLORER style is not present.

  • [in] lpWin4ID
    Contains the name of the template resource of the Explorer CFileDialog object. This template is used only on Windows NT 4.0 and later versions, Windows 95 and later versions, or when the OFN_EXPLORER style is present.

Remarks

The system will use only one of the specified templates. The system determines which template to use based on the presence of the OFN_EXPLORER style and the operating system that the application is running on. By specifying both a non-Explorer and Explorer-style template, it is easy to support Windows NT 3.51, Windows NT 4.0 and later versions, and Windows 95 and later versions.

Note

Windows Vista style file dialog boxes do not support this function. Attempting to use this function on a Windows Vista style file dialog box will throw CNotSupportedException. See CFileDialog Class for more information. An alternative is to use a customized dialog. For more information about using a custom CFileDialog, see IFileDialogCustomize.

Requirements

**Header:**afxdlgs.h

See Also

Reference

CFileDialog Class

Hierarchy Chart