IVsHierarchyDeleteHandler.QueryDeleteItem(UInt32, UInt32, Int32) Method

Definition

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

public:
 int QueryDeleteItem(System::UInt32 dwDelItemOp, System::UInt32 itemid, [Runtime::InteropServices::Out] int % pfCanDelete);
int QueryDeleteItem(unsigned int dwDelItemOp, unsigned int itemid, [Runtime::InteropServices::Out] int & pfCanDelete);
public int QueryDeleteItem (uint dwDelItemOp, uint itemid, out int pfCanDelete);
abstract member QueryDeleteItem : uint32 * uint32 * int -> int
Public Function QueryDeleteItem (dwDelItemOp As UInteger, itemid As UInteger, ByRef pfCanDelete As Integer) As Integer

Parameters

dwDelItemOp
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
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
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.

Returns

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.

Applies to