IVsPersistHierarchyItem.SaveItem Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Saves the hierarchy item to disk.
public:
int SaveItem(Microsoft::VisualStudio::Shell::Interop::VSSAVEFLAGS dwSave, System::String ^ pszSilentSaveAsName, System::UInt32 itemid, IntPtr punkDocData, [Runtime::InteropServices::Out] int % pfCanceled);
public int SaveItem (Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS dwSave, string pszSilentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCanceled);
abstract member SaveItem : Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS * string * uint32 * nativeint * int -> int
Public Function SaveItem (dwSave As VSSAVEFLAGS, pszSilentSaveAsName As String, itemid As UInteger, punkDocData As IntPtr, ByRef pfCanceled As Integer) As Integer
Parameters
- dwSave
- VSSAVEFLAGS
[in] Flags whose values are taken from the VSSAVEFLAGS enumeration.
- pszSilentSaveAsName
- String
[in] File name to be applied when dwSave
is set to VSSAVE_SilentSave.
- itemid
- UInt32
[in] Item identifier of the hierarchy item saved from VSITEMID
.
- punkDocData
-
IntPtr
nativeint
[in] Pointer to the IUnknown
interface of the hierarchy item saved.
- pfCanceled
- Int32
[out] true
if the save action was canceled.
Returns
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsPersistHierarchyItem::SaveItem(
[in] VSSAVEFLAGS dwSave,
[in] LPCOLESTR pszSilentSaveAsName,
[in] VSITEMID itemid,
[in] IUnknown *punkDocData,
[out] BOOL *pfCanceled
);
The caller of this method is responsible for determining whether the document is in the Running Document Table and should pass in the correct punkDocData
parameter. It is not necessary for the implementer of this method to call the FindAndLockDocument method when punkDocData
is null
.
When a document is saved, this method is called to enable the owning hierarchy to establish control. Then the hierarchy can use any private mechanism to persist the document. For hierarchies that use standard editors, the implementation of SaveItem
method is to call the following:
For VSSAVE_Save and VSSAVE_SaveAs, it will Query Interface for IVsPersistDocData on the document data object and call SaveDocData.
For VSSAVE_SilentSave, it will Query Interface for IPersistFileFormat on the document data object and use this interface in a call to the method SaveDocDataToFile passing the parameters VSSAVE_SilentSave
, pPersistFile, pszSilentSaveAsNamelpstrUntitledPath, &bstrDocumentNew
, and&fCanceled
).