Condividi tramite


IVsHierarchyDeleteHandler.QueryDeleteItem Method

Called by the environment to determine whether the hierarchy supports item deletion, removal, or both.

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

Syntax

'Dichiarazione
Function QueryDeleteItem ( _
    dwDelItemOp As UInteger, _
    itemid As UInteger, _
    <OutAttribute> ByRef pfCanDelete As Integer _
) As Integer
'Utilizzo
Dim instance As IVsHierarchyDeleteHandler
Dim dwDelItemOp As UInteger
Dim itemid As UInteger
Dim pfCanDelete As Integer
Dim returnValue As Integer

returnValue = instance.QueryDeleteItem(dwDelItemOp, _
    itemid, pfCanDelete)
int QueryDeleteItem(
    uint dwDelItemOp,
    uint itemid,
    out int pfCanDelete
)
int QueryDeleteItem(
    [InAttribute] unsigned int dwDelItemOp, 
    [InAttribute] unsigned int itemid, 
    [OutAttribute] int% pfCanDelete
)
function QueryDeleteItem(
    dwDelItemOp : uint, 
    itemid : uint, 
    pfCanDelete : int
) : int

Parameters

  • dwDelItemOp
    Type: System.UInt32

    [in] Determines whether the hierarchy or hierarchy item is deleted from storage or removed from the project. Values are taken from the __VSDELETEITEMOPERATION enumeration.

  • pfCanDelete
    Type: System.Int32%

    [out] If true, then the hierarchy supports either item deletion or item removal, depending on the value specified for the dwDelItemOp parameter. If false, then the hierarchy or hierarchy item cannot be deleted.

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 IVsHierarchyDeleteHandler::QueryDeleteItem(
   [in] VSDELETEITEMOPERATION dwDelItemOp,
   [in] VSITEMID itemid,
   [out, retval] BOOL *pfCanDelete
);

When an item in a hierarchy is selected, the environment calls this method twice on that hierarchy: once to determine if the hierarchy supports item deletion, and once to determine if the hierarchy supports item removal. Based on the result of this method, the environment modifies the context menu or the dialog box shown when delete or remove are selected from the context menu. If either remove or delete are supported, then a Remove or Delete command is shown in the context menu, respectively. If both options are supported, then a dialog box is shown querying the user whether to delete or remove the item. If neither remove nor delete are supported, then Remove and Delete commands are not shown in the context menu. If QueryDeleteItem returns zero, the delete command is displayed grayed.

When either the Remove or Delete command is selected by the user, the environment then calls DeleteItem.

Permissions

See Also

Reference

IVsHierarchyDeleteHandler Interface

IVsHierarchyDeleteHandler Members

Microsoft.VisualStudio.Shell.Interop Namespace