MSDN Library

IFileSaveDialog::SetFileTypes Method

Sets the file types that the dialog can open or save.

Syntax


HRESULT SetFileTypes(          UINT cFileTypes,
    const COMDLG_FILTERSPEC *rgFilterSpec
);

Parameters

cFileTypes
[in] The number of elements in the array specified by rgFilterSpec.
rgFilterSpec
[in] A pointer to an array of COMDLG_FILTERSPEC structures, each representing a file type.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

When using the Open dialog, the file types declared there are used to filter the view. When using the Save dialog, these values determine which file extension is appended to the file name.

Example

The following code example demonstrates the use of the COMDLG_FILTERSPEC structure in the context of this method.


COMDLG_FILTERSPEC rgSpec[] =
{ 
    { szJPG, L"*.jpg;*.jpeg" },
    { szBMP, L"*.bmp" },
    { szAll, L"*.*" },
};

Community Additions

Show:
© 2016 Microsoft