IFileDialog::SetDefaultExtension method (shobjidl_core.h)

Sets the default extension to be added to file names.

Syntax

HRESULT SetDefaultExtension(
  [in] LPCWSTR pszDefaultExtension
);

Parameters

[in] pszDefaultExtension

Type: LPCWSTR

A pointer to a buffer that contains the extension text. This string should not include a leading period. For example, "jpg" is correct, while ".jpg" is not.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If this method is called before showing the dialog, the dialog will update the default extension automatically when the user chooses a new file type (see SetFileTypes).

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)