Partager via


IPersistFileFormat.Save Method

Saves a copy of the object into the specified file.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function Save ( _
    pszFilename As String, _
    fRemember As Integer, _
    nFormatIndex As UInteger _
) As Integer
int Save(
    string pszFilename,
    int fRemember,
    uint nFormatIndex
)
int Save(
    [InAttribute] String^ pszFilename, 
    [InAttribute] int fRemember, 
    [InAttribute] unsigned int nFormatIndex
)
abstract Save : 
        pszFilename:string * 
        fRemember:int * 
        nFormatIndex:uint32 -> int
function Save(
    pszFilename : String, 
    fRemember : int, 
    nFormatIndex : uint
) : int

Parameters

  • pszFilename
    Type: String

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

  • fRemember
    Type: 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 nulla null reference (Nothing in Visual Basic), the implementation ignores the fRemember flag.

  • nFormatIndex
    Type: 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. An index value of 0 indicates the first format, 1 the second format, and so on.

Return Value

Type: Int32
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
);

.NET Framework Security

See Also

Reference

IPersistFileFormat Interface

Microsoft.VisualStudio.Shell.Interop Namespace