Freigeben über


IVsPersistHierarchyItem.SaveItem Method

Saves the hierarchy item to disk.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function SaveItem ( _
    dwSave As VSSAVEFLAGS, _
    pszSilentSaveAsName As String, _
    itemid As UInteger, _
    punkDocData As IntPtr, _
    <OutAttribute> ByRef pfCanceled As Integer _
) As Integer
'Usage
Dim instance As IVsPersistHierarchyItem
Dim dwSave As VSSAVEFLAGS
Dim pszSilentSaveAsName As String
Dim itemid As UInteger
Dim punkDocData As IntPtr
Dim pfCanceled As Integer
Dim returnValue As Integer

returnValue = instance.SaveItem(dwSave, _
    pszSilentSaveAsName, itemid, punkDocData, _
    pfCanceled)
int SaveItem(
    VSSAVEFLAGS dwSave,
    string pszSilentSaveAsName,
    uint itemid,
    IntPtr punkDocData,
    out int pfCanceled
)
int SaveItem(
    [InAttribute] VSSAVEFLAGS dwSave, 
    [InAttribute] String^ pszSilentSaveAsName, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] IntPtr punkDocData, 
    [OutAttribute] int% pfCanceled
)
abstract SaveItem : 
        dwSave:VSSAVEFLAGS * 
        pszSilentSaveAsName:string * 
        itemid:uint32 * 
        punkDocData:IntPtr * 
        pfCanceled:int byref -> int 
function SaveItem(
    dwSave : VSSAVEFLAGS, 
    pszSilentSaveAsName : String, 
    itemid : uint, 
    punkDocData : IntPtr, 
    pfCanceled : int
) : int

Parameters

  • itemid
    Type: System.UInt32
    [in] Item identifier of the hierarchy item saved from VSITEMID.
  • punkDocData
    Type: System.IntPtr
    [in] Pointer to the IUnknown interface of the hierarchy item saved.
  • pfCanceled
    Type: System.Int32%
    [out] true if the save action was canceled.

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 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 nulla null reference (Nothing in Visual Basic).

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:

.NET Framework Security

See Also

Reference

IVsPersistHierarchyItem Interface

IVsPersistHierarchyItem Members

Microsoft.VisualStudio.Shell.Interop Namespace