Condividi tramite


IVsUIShell.SaveDocDataToFile Method

Definition

Helper method used by editors that implement the IVsPersistDocData interface.

public:
 int SaveDocDataToFile(Microsoft::VisualStudio::Shell::Interop::VSSAVEFLAGS grfSave, System::Object ^ pPersistFile, System::String ^ pszUntitledPath, [Runtime::InteropServices::Out] System::String ^ % pbstrDocumentNew, [Runtime::InteropServices::Out] int % pfCanceled);
int SaveDocDataToFile(Microsoft::VisualStudio::Shell::Interop::VSSAVEFLAGS grfSave, winrt::Windows::Foundation::IInspectable const & pPersistFile, std::wstring const & pszUntitledPath, [Runtime::InteropServices::Out] std::wstring const & & pbstrDocumentNew, [Runtime::InteropServices::Out] int & pfCanceled);
public int SaveDocDataToFile (Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS grfSave, object pPersistFile, string pszUntitledPath, out string pbstrDocumentNew, out int pfCanceled);
abstract member SaveDocDataToFile : Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS * obj * string * string * int -> int
Public Function SaveDocDataToFile (grfSave As VSSAVEFLAGS, pPersistFile As Object, pszUntitledPath As String, ByRef pbstrDocumentNew As String, ByRef pfCanceled As Integer) As Integer

Parameters

grfSave
VSSAVEFLAGS

[in] Specifies file Save options. For more information, see VSSAVEFLAGS.

pPersistFile
Object

[in] Pointer to the IUnknown interface of the file in which the doc data is to be saved.

pszUntitledPath
String

[in] File path to which the doc data for an as-yet unsaved document is to be saved.

pbstrDocumentNew
String

[out] New document file name.

pfCanceled
Int32

[out] Set to true if the user aborts the save by clicking the Cancel button.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIShell::SaveDocDataToFile(  
   [in] VSSAVEFLAGS grfSave,  
   [in] IUnknown *pPersistFile,  
   [in] LPCOLESTR pszUntitledPath,  
   [out] BSTR *pbstrDocumentNew,  
   [out] BOOL *pfCanceled  
);  

This method helps implement the Save As dialog box. The document data object implements IPersistFileFormat to perform the save operation. This method manages the Save As dialog box using the IPersistFileFormat pointer passed as input.

The standard case is when a document saves all of its information to a file. Typically, a save operation fails if there is a problem with the destination (for example, disk full, disk write protected, not correct, and so on). An object is not expected to fail a save operation for other reasons than a bad choice of destination. Thus, if the save failed, the user is informed of the problem and is led to the dialog box where a new destination can be chosen (that is, the Save As dialog box). For the case where a document saves some information to a separate store and other information to the file, if the save of the first information to the separate store fails, there is no point in trying a different destination for the file portion. In this situation the document returns a value of OLE_E_PROMPTSAVECANCELED from Save.

Applies to