共用方式為


IPersistFileFormat.GetFormatList(String) Method

Definition

Provides the caller with the information necessary to open the standard common Save As dialog box (using the GetSaveFileNameViaDlg(VSSAVEFILENAMEW[]) function) on behalf of the object.

public:
 int GetFormatList([Runtime::InteropServices::Out] System::String ^ % ppszFormatList);
int GetFormatList([Runtime::InteropServices::Out] std::wstring const & & ppszFormatList);
public int GetFormatList (out string ppszFormatList);
abstract member GetFormatList : string -> int
Public Function GetFormatList (ByRef ppszFormatList As String) As Integer

Parameters

ppszFormatList
String

[out] Pointer to a string that contains pairs of format filter strings.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From fpstfmt.idl:

HRESULT IPersistFileFormat::GetFormatList(  
   [out] LPOLESTR *ppszFormatList  
);  

GetFormatList returns an enumeration of supported formats, from which the caller selects the appropriate format. The selection is then passed back to the Save method.

Each string should be terminated with a newline (\n) character. The last string in the buffer must be terminated with the newline character as well. The caller can replace each newline character with a null (\0) character. Then, the caller can have a string that is the same as the lpstrFilter member of the WinAPI VSOPENFILENAMEW structure. The first string in each pair is a display string that describes the filter, such as "Text Only (*.txt)". The second string specifies the filter pattern, such as "*.txt". To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns: "*.htm;*.html;*.asp". A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. The following string is an example of a file pattern string: "HTML File (*.htm; *.html; *.asp)\n*.htm;*.html;*.asp\nText File (*.txt)\n*.txt\n."

Applies to