}// InsertChildren internal void InsertSpecificChild(int iChild) { SCOPEDATAITEM sdi = new SCOPEDATAITEM(); CNode nChild = CNodeManager.GetNode(iChild); sdi.mask = SDI.STR | SDI.PARAM | SDI.PARENT | SDI.IMAGE | SDI.OPENIMAGE | SDI.CHILDREN; // The image index is going to be the same as the cookie value sdi.nImage = CResourceStore.GetIconCookie(nChild.IconHandle); // The open image is the same as the closed image sdi.nOpenImage = sdi.nImage; sdi.relativeID = m_iHScopeItem; // We set displayname to -1 to initiate a callback for the string // (We need to do it this way... it's an MMCism) sdi.displayname = (IntPtr)(-1); sdi.lParam = nChild.Cookie; // The children field is set to either 0 or 1 (if it has children or not) sdi.cChildren = (nChild.NumChildren == 0)?0:1; // Once the item has been inserted, we're given the HScopeItem value for the node // MMC uses this value to uniquely identify the node. We'll store it for future // use. nChild.HScopeItem = CNodeManager.InsertItem(sdi); // We'll also put in the parent's HScopeItem nChild.m_iParentHScopeItem = HScopeItem; // Also, we can be slick and expand this child's node too // We don't care about perf savings after startup... do the expansion now // Also, if we have a non MMC host, we're not sure how it will behave // if it doesn't have all the nodes. Let's force the expand if we're not // running under MMC if (m_fInitialCreationDone || CNodeManager.Console is INonMMCHost) { // Expand this child CNodeManager.ExpandNodeNamespace(nChild.HScopeItem); } else if (Cookie == 0) { Thread t = new Thread(new ThreadStart(nChild.LazyExpand)); t.Start(); } }// InsertSpecificChild