Freigeben über


How to: Rename Project Hierarchy Nodes (C++)

You can rename a project folder hierarchy node by using the HierUtil7 project framework for unmanaged C++. For more information, see HierUtil7 Sample.

Expanding the Hierarchy node

To expand the hierarchy node and rename the folder

  1. Select the hierarchy node by using the following method:

    IfFailGo(pNode->ExtExpand(EXPF_SelectItem, GUID_MacroExplorer));
    

    pNode is the hierarchy container corresponding to the folder and EXPF_SelectItem is from the EXPANDFLAGS enumeration. The GUID_MacroExplorer is a GUID constant defined in Vsshell.idl and is an example for rguidPersistenceSlot in the function signature of ExtExpand, defined in Hu_node.h.

    HRESULT ExtExpand(EXPANDFLAGS expandflags, REFGUID rguidPersistenceSlot = GUID_SolutionExplorer) const;
    

    You can find the Hu_node.h file in the folder, <installation root>\Program Files\VSIP 8.0\EnvSDK\common\hierutil7:

  2. Rename the folder by posting the rename command by using PostExecCommand

    IfFailGo(srpVsUIShell->PostExecCommand(&guidVSStd97, cmdidRename, 0, NULL));
    

    srpVsUIShell is a IVsUIShell pointer: <IVsUIShell> srpVsUIShell. guiVSStd97 is a unique identifier of the command group to which the command cmdidRename belongs, defined in Vsshlids.h.

See Also

Concepts

Visual Studio Extensibility Samples

Other Resources

Creating Project Types