Share via


IPersistFileFormat.GetCurFile Method

Returns the path to an object's current working file, or, if there is not a current working file, the object's default file name prompt.

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

Syntax

'Declaration
Function GetCurFile ( _
    <OutAttribute> ByRef ppszFilename As String, _
    <OutAttribute> ByRef pnFormatIndex As UInteger _
) As Integer
int GetCurFile(
    out string ppszFilename,
    out uint pnFormatIndex
)
int GetCurFile(
    [OutAttribute] String^% ppszFilename, 
    [OutAttribute] unsigned int% pnFormatIndex
)
abstract GetCurFile : 
        ppszFilename:string byref * 
        pnFormatIndex:uint32 byref -> int
function GetCurFile(
    ppszFilename : String, 
    pnFormatIndex : uint
) : int

Parameters

  • ppszFilename
    Type: System.String%

    [out] Pointer to the file name. If the object has a valid file name, the file name is returned as the ppszFilename out parameter. If the object is in the untitled state, nulla null reference (Nothing in Visual Basic) is returned as the ppszFilename out parameter.

    Note   This result differs from that of the standard GetCurFile method, which returns S_FALSE and a "Save As" prompt string.

  • pnFormatIndex
    Type: System.UInt32%

    [out] Value that indicates the current format of the file. This value is interpreted as a zero-based index into the list of formats, as returned by a call to GetFormatList. An index value of zero indicates the first format, 1 the second format, and so on. If the object supports only a single format, it returns zero. Subsequently, it returns a single element in its format list through a call to GetFormatList.

Return Value

Type: System.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::GetCurFile(
   [out] LPOLESTR *ppszFilename,
   [out] DWORD *pnFormatIndex
);

This method is similar to GetCurFile. In order to save the current file in the current format, call GetCurFile to retrieve the current format index value in order to pass it properly to the Save method.

.NET Framework Security

See Also

Reference

IPersistFileFormat Interface

Microsoft.VisualStudio.Shell.Interop Namespace