INameSpaceTreeControl2::InsertRoot Method

Inserts a Shell item on a root item in a tree.

Syntax

HRESULT InsertRoot(      
    int iIndex,
    IShellItem *psiRoot,
    SHCONTF grfEnumFlags,
    NSTCROOTSTYLE grfRootStyle,
    IShellItemFilter *pif
);

Parameters

  • iIndex
    [in] The index at which to insert the root.
  • psiRoot
    [in] A pointer to the Shell item that is being inserted.
  • grfEnumFlags
    [in] Enumerates the qualities of the root and all of its children. One of the values of type SHCONTF.
  • grfRootStyle
    [in] The style of the root that is being inserted. One or more of the following values (flags can be combined using a bitwise OR).
    • NSTCRS_VISIBLE
      The root is visible as well as the items. Mutually exclusive with with NSTCRS_HIDDEN.
    • NSTCRS_HIDDEN
      The root is hidden so that only the children are visible. Mutually exclusive with NSTCRS_VISIBLE.
    • NSTCRS_EXPANDED
      The root is expanded upon initialization.
  • pif
    [in] A pointer to the IShellItemFilter that enables you to filter which items in the tree are displayed. If supplied, every item is customizable with a SHCONTF flag. This value can be NULL if no filter is required.

Return Value

Returns S_OK if successful, or an error value otherwise.