void CDeviceView::DisplayPropertySheet() { CNode *Node = GetSelectedNode(); if (Node && Node->HasProperties()) { DevicePropertiesExW(m_hTreeView, NULL, Node->GetDeviceId(), 1,//DPF_EXTENDED, FALSE); } }
HTREEITEM CDeviceView::RecurseFindDevice( _In_ HTREEITEM hParentItem, _In_ CNode *Node ) { HTREEITEM FoundItem; HTREEITEM hItem; TVITEMW tvItem; CNode *FoundNode; // Check if this node has any children hItem = TreeView_GetChild(m_hTreeView, hParentItem); if (hItem == NULL) return NULL; // The lParam contains the node pointer data tvItem.hItem = hItem; tvItem.mask = TVIF_PARAM; if (TreeView_GetItem(m_hTreeView, &tvItem) && tvItem.lParam != NULL) { // check for a matching node FoundNode = reinterpret_cast<CNode *>(tvItem.lParam); if ((FoundNode->GetNodeType() == Node->GetNodeType()) && (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid()))) { // check if this is a class node, or a device with matching ID's if ((FoundNode->GetNodeType() == ClassNode) || (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0)) { return hItem; } } } // This node may have its own children FoundItem = RecurseFindDevice(hItem, Node); if (FoundItem) return FoundItem; // Loop all the siblings for (;;) { // Get the next item at this level hItem = TreeView_GetNextSibling(m_hTreeView, hItem); if (hItem == NULL) break; // The lParam contains the node pointer data tvItem.hItem = hItem; tvItem.mask = TVIF_PARAM; if (TreeView_GetItem(m_hTreeView, &tvItem)) { // check for a matching class FoundNode = reinterpret_cast<CNode *>(tvItem.lParam); if ((FoundNode->GetNodeType() == Node->GetNodeType()) && (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid()))) { // check if this is a class node, or a device with matching ID's if ((FoundNode->GetNodeType() == ClassNode) || (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0)) { return hItem; } } } // This node may have its own children FoundItem = RecurseFindDevice(hItem, Node); if (FoundItem) return FoundItem; } return hItem; }