本文整理汇总了C++中CNode::GetNodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::GetNodeType方法的具体用法?C++ CNode::GetNodeType怎么用?C++ CNode::GetNodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNode
的用法示例。
在下文中一共展示了CNode::GetNodeType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
unsigned int __stdcall CDeviceView::RefreshThread(void *Param)
{
RefreshThreadData *ThreadData = (RefreshThreadData *)Param;
CDeviceView *This = ThreadData->This;
// Get a copy of the currently selected node
CNode *LastSelectedNode = This->GetSelectedNode();
if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode))
{
LastSelectedNode = new CRootNode(*This->m_RootNode);
}
else if (LastSelectedNode->GetNodeType() == ClassNode)
{
LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
}
else if (LastSelectedNode->GetNodeType() == DeviceNode)
{
LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
}
// Empty the treeview
This->EmptyDeviceView();
// Re-add the root node to the tree
if (This->AddRootDevice() == false)
return 0;
// Refresh the devices only if requested
if (ThreadData->ScanForChanges)
{
This->RefreshDeviceList();
}
// display the type of view the user wants
switch (This->m_ViewType)
{
case DevicesByType:
(void)This->ListDevicesByType();
break;
case DevicesByConnection:
(VOID)This->ListDevicesByConnection();
break;
case ResourcesByType:
break;
case ResourcesByConnection:
break;
}
This->SelectNode(LastSelectedNode);
delete ThreadData;
return 0;
}
示例2: RecurseFindDevice
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;
}