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

'Declaration
Function QueryDeleteItem ( _
    dwDelItemOp As UInteger, _
    itemid As UInteger, _
    <OutAttribute> ByRef pfCanDelete As Integer _
) As Integer
int QueryDeleteItem(
    uint dwDelItemOp,
    uint itemid,
    out int pfCanDelete
)
int QueryDeleteItem(
    [InAttribute] unsigned int dwDelItemOp, 
    [InAttribute] unsigned int itemid, 
    [OutAttribute] int% pfCanDelete
)
abstract QueryDeleteItem : 
        dwDelItemOp:uint32 * 
        itemid:uint32 * 
        pfCanDelete:int byref -> int
function QueryDeleteItem(
    dwDelItemOp : uint, 
    itemid : uint, 
    pfCanDelete : int
) : int

Parameters

  • dwDelItemOp
    Type: 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.

  • itemid
    Type: UInt32

    [in] Item identifier of an item in the hierarchy. Use VSITEMID_ROOT to delete all in the hierarchy. VSITEMID_SELECTION is not supported.

  • pfCanDelete
    Type: 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: 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.

.NET Framework Security

See Also

Reference

IVsHierarchyDeleteHandler Interface

Microsoft.VisualStudio.Shell.Interop Namespace