检索 IVsHierarchy 的所有节点

Retrieve all nodes of a IVsHierarchy

我正在寻找一种方法来获取给定 IVsHierarchy 的所有子节点。来自 documentation itself I can't see any way to get a list of all items, just a way to get the properties of any item with the GetProperty method. Which has a parameter named itemid, which from my understanding should be fed with an unique id of any of its nodes. Anyhow as per documentation it should be of type VSConstants.VSITEMID,但这有点不对。

对于任何给定节点,您需要通过使用 __VSHPROPID.VSHPROPID_FirstChild 和 __VSHPROPID_VSHPROPID_NextSibling.

调用 IVsHierarchy.GetProperty 来迭代树结构

archived SCC extensibility samples 中隐藏了几个示例。您可以使用它来获得更多指导。

真诚的, 埃德·多尔