IPersistFileFormat.GetCurFile(String, UInt32) Method

Definition

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.

public:
 int GetCurFile([Runtime::InteropServices::Out] System::String ^ % ppszFilename, [Runtime::InteropServices::Out] System::UInt32 % pnFormatIndex);
int GetCurFile([Runtime::InteropServices::Out] std::wstring const & & ppszFilename, [Runtime::InteropServices::Out] unsigned int & pnFormatIndex);
public int GetCurFile (out string ppszFilename, out uint pnFormatIndex);
abstract member GetCurFile : string * uint32 -> int
Public Function GetCurFile (ByRef ppszFilename As String, ByRef pnFormatIndex As UInteger) As Integer

Parameters

ppszFilename
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, null is returned as the ppszFilename out parameter. Note   This result differs from that of the standard GetCurFile(String) method, which returns S_FALSE and a "Save As" prompt string.

pnFormatIndex
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(String). 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(String).

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::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.

Applies to