c++ - C ++ windows ui自动化:无法列出所有子窗口
问题描述
我正在尝试特别列出所有“名称”子窗口:取消静音当前静音(按钮)
这是我列出所有孩子的代码:
void ListDescendants(IUIAutomationElement* pParent, int indent)
{
if (pParent == NULL)
return;
IUIAutomationTreeWalker* pControlWalker = NULL;
IUIAutomationElement* pNode = NULL;
g_pAutomation->get_ControlViewWalker(&pControlWalker);
if (pControlWalker == NULL)
goto cleanup;
pControlWalker->GetFirstChildElement(pParent, &pNode);
if (pNode == NULL)
goto cleanup;
while (pNode)
{
BSTR desc;
pNode->get_CurrentName(&desc);
for (int x = 0; x <= indent; x++)
{
std::wcout << L" ";
}
std::wcout << desc << L"\n";
SysFreeString(desc);
ListDescendants(pNode, indent+1);
IUIAutomationElement* pNext;
pControlWalker->GetNextSiblingElement(pNode, &pNext);
pNode->Release();
pNode = pNext;
}
cleanup:
if (pControlWalker != NULL)
pControlWalker->Release();
if (pNode != NULL)
pNode->Release();
return;
}
但输出是:
ContentLeftPanel
VideoContainerWnd
Video Content
我只想要那个静音/静音按钮的名称/标题..为此我需要所有子窗口的列表...
解决方案
推荐阅读
- node.js - node.js 服务器中的 Firebase 身份验证持久性
- google-apps-script - 如何为同一个电子表格上的不同工作表应用相同的脚本?
- r - 识别 R 中连续值的中断
- r - 使用光栅包打开包含多个变量的 NetCDF 文件
- html - 抓取 dl,dt,dd HTML 数据
- c# - 如何用 C# 和 NAudio 覆盖两个 wav 文件?
- javascript - 使用 JavaScript 更改具有类名的 div 的 CSS
- objective-c - 选择相似的像素,围绕像素绘制贝塞尔路径并填充颜色 - iOS
- linux - 诊断导致系统崩溃的应用程序
- node.js - Vue CLI & Webpack:无法让 webpack-dev-server 运行