IVsUIShell.SaveDocDataToFile Method
Helper method used by editors that implement the IVsPersistDocData interface.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Dichiarazione
Function SaveDocDataToFile ( _
grfSave As VSSAVEFLAGS, _
pPersistFile As Object, _
pszUntitledPath As String, _
<OutAttribute> ByRef pbstrDocumentNew As String, _
<OutAttribute> ByRef pfCanceled As Integer _
) As Integer
'Utilizzo
Dim instance As IVsUIShell
Dim grfSave As VSSAVEFLAGS
Dim pPersistFile As Object
Dim pszUntitledPath As String
Dim pbstrDocumentNew As String
Dim pfCanceled As Integer
Dim returnValue As Integer
returnValue = instance.SaveDocDataToFile(grfSave, _
pPersistFile, pszUntitledPath, pbstrDocumentNew, _
pfCanceled)
int SaveDocDataToFile(
VSSAVEFLAGS grfSave,
Object pPersistFile,
string pszUntitledPath,
out string pbstrDocumentNew,
out int pfCanceled
)
int SaveDocDataToFile(
[InAttribute] VSSAVEFLAGS grfSave,
[InAttribute] Object^ pPersistFile,
[InAttribute] String^ pszUntitledPath,
[OutAttribute] String^% pbstrDocumentNew,
[OutAttribute] int% pfCanceled
)
function SaveDocDataToFile(
grfSave : VSSAVEFLAGS,
pPersistFile : Object,
pszUntitledPath : String,
pbstrDocumentNew : String,
pfCanceled : int
) : int
Parameters
grfSave
Type: Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS[in] Specifies file Save options. For more information, see VSSAVEFLAGS.
pPersistFile
Type: System.Object[in] Pointer to the IUnknown interface of the file in which the doc data is to be saved.
pszUntitledPath
Type: System.String[in] File path to which the doc data for an as-yet unsaved document is to be saved.
pbstrDocumentNew
Type: System.String%[out] New document file name.
pfCanceled
Type: System.Int32%[out] Set to true if the user aborts the save by clicking the Cancel button.
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 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.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.