This documentation is archived and is not being maintained.


Finds image formats available for saving images.

static HRESULT GetExporterFilterString(
   CSimpleString& strExporters,
   CSimpleArray< GUID >& aguidFileTypes,
   LPCTSTR pszAllFilesDescription = NULL,
   DWORD dwExclude = excludeDefaultSave,
   TCHAR chSeparator = _T( '|' )


A reference to a CSimpleString object. See Remarks for more information.
An array of GUIDs, with each element corresponding to one of the file types in the string. In the example in pszAllFilesDescription below, aguidFileTypes[0] is GUID_NULL and the remaining array values are the image file formats supported by the current operating system.
Note   For a complete list of constants, see Image File Format Constants in the Platform SDK.
If this parameter is not NULL, the filter string will have one additional filter at the beginning of the list. This filter will have the current value of pszAllFilesDescription for its description, and accepts files of any extension supported by any other exporter in the list.

For example:

//First filter in the list will be titled "All Image Files", and
//will accept files with any extension supported by any exporter.
GetExporterFilterString( strExporters, aguidFileTypes, _T( "All Image Files" ));
Set of bit flags specifying which file types to exclude from the list. Allowable flags are:
  • excludeGIF = 0x01   Excludes GIF files.
  • excludeBMP = 0x02   Excludes BMP (Windows Bitmap) files.
  • excludeEMF = 0x04   Excludes EMF (Enhanced Metafile) files.
  • excludeWMF = 0x08   Excludes WMF (Windows Metafile) files.
  • excludeJPEG = 0x10   Excludes JPEG files.
  • excludePNG = 0x20   Excludes PNG files.
  • excludeTIFF = 0x40   Excludes TIFF files.
  • excludeIcon = 0x80   Excludes ICO (Windows Icon) files.
  • excludeOther = 0x80000000   Excludes any other file type not listed above.
  • excludeDefaultLoad = 0   For load, all file types are included by default
  • excludeDefaultSave = excludeIcon | excludeEMF | excludeWMF   For saving, these files are excluded by default because they usually have special requirements.
The separator used between the image formats. See Remarks for more information.

Return Value

A standard HRESULT.


You can pass the resulting format string to your MFC CFileDialog object to expose the file extensions of the available image formats in the File Save As dialog box.

The parameter strExporter has the format:

file description0|*.ext0|filedescription1|*.ext1|...file descriptionn|*.extn||

where '|' is the separator character specified by chSeparator. For example:

"Bitmap format|*.bmp|JPEG format|*.jpg|GIF format|*.gif|PNG format|*.png||"

Use the default separator '|' if you pass this string to an MFC CFileDialog object. Use the null separator '\0' if you pass this string to a common File Save dialog box.

See Also

CImage Overview | Class Members | GetImporterFilterString | CFileDialog::m_ofn | CFileDialog::GetFileExt | OPENFILENAME | CFileDialog::SetDefExt