다음을 통해 공유


IVsPersistHierarchyItem2.SaveItem Method

Definition

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.

Implements

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsPersistHierarchyItem2::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:

Applies to