IPersistFileFormat.Save(String, Int32, UInt32) Method

Definition

Saves a copy of the object into the specified file.

public:
 int Save(System::String ^ pszFilename, int fRemember, System::UInt32 nFormatIndex);
public:
 int Save(Platform::String ^ pszFilename, int fRemember, unsigned int nFormatIndex);
int Save(std::wstring const & pszFilename, int fRemember, unsigned int nFormatIndex);
public int Save (string pszFilename, int fRemember, uint nFormatIndex);
abstract member Save : string * int * uint32 -> int
Public Function Save (pszFilename As String, fRemember As Integer, nFormatIndex As UInteger) As Integer

Parameters

pszFilename
String

[in] Pointer to the file name. The pszFilename parameter can be null; it instructs the object to save using its current file. If the object is in the untitled state and null is passed as the pszFilename, the object returns E_INVALIDARG. You must specify a valid file name parameter in this situation.

fRemember
Int32

[in] Boolean value that indicates whether the pszFileName parameter is to be used as the current working file. If true, pszFileName becomes the current file and the object should clear its dirty flag after the save. If false, this save operation is a Save a Copy As operation. In this case, the current file is unchanged and the object does not clear its dirty flag. If pszFileName is null, the implementation ignores the fRemember flag.

nFormatIndex
UInt32

[in] Value that indicates the format in which the file will be saved. The caller passes DEF_FORMAT_INDEX if the object is to choose its default (current) format. If set to non-zero, the value is interpreted as the index into the list of formats, as returned by a call to the method GetFormatList(String). An index value of 0 indicates the first format, 1 the second format, and so on.

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::Save(  
   [in] LPCOLESTR pszFilename,  
   [in] BOOL fRemember,  
   [in] DWORD nFormatIndex  
);  

Applies to