C++ 在Windows 8上使用Windows UI Automation列出Metro应用程序的所有UI元素
我有一个地铁应用程序。我正在开发一个自动化客户端。我想列出Metro应用程序的所有元素C++ 在Windows 8上使用Windows UI Automation列出Metro应用程序的所有UI元素,c++,windows-8,microsoft-metro,windows-runtime,C++,Windows 8,Microsoft Metro,Windows Runtime,我有一个地铁应用程序。我正在开发一个自动化客户端。我想列出Metro应用程序的所有元素 我正在通过IApplicationActivationManager启动metro应用程序 我得到了聚焦元素 HRESULT hr=automation->GetRootElement(&pRoot) hr=自动化->获取焦点删除(&pFound) 现在我想列出所有控件,如按钮、图片元素和其他 我正在使用自动化接口的FindAll来获取元素 // Create a property condition
hr=自动化->获取焦点删除(&pFound)
// Create a property condition for the button control type.
VARIANT varProp;
varProp.vt = VT_I4;
varProp.lVal = UIA_ButtonControlTypeId;
hr = automation->CreatePropertyCondition(UIA_ControlTypePropertyId, varProp, &pButtonCondition);
if (pButtonCondition == NULL)
goto cleanup;
// Create a property condition for the enabled property.
varProp.vt = VT_BOOL;
varProp.boolVal = VARIANT_TRUE;
hr = automation->CreatePropertyCondition(UIA_IsEnabledPropertyId, varProp, &pEnabledCondition);
if (pEnabledCondition == NULL)
goto cleanup;
// Combine the conditions.
hr = automation->CreateAndCondition(pButtonCondition, pEnabledCondition, &pCombinedCondition);
if (pCombinedCondition == NULL)
goto cleanup;
// Find the matching elements. Note that if the scope is changed to TreeScope_Descendants,
// system buttons on the caption bar will be found as well.
hr = pParent->FindAll(TreeScope_Children, pCombinedCondition, &pFound);
这是metro应用程序中唯一的列表按钮。
我想列出窗口上的所有控件。请帮忙。如何获取Metro应用程序的所有元素?我找到了……如果我们使用true condition,我们可以在UI上找到所有元素
IUIAutomationCondition* pCombinedCondition = NULL;
hr = automation->CreateTrueCondition(&pCombinedCondition);
if (pCombinedCondition == NULL)
goto cleanup;
// Find the matching elements. Note that if the scope is changed to TreeScope_Descendants,
// system buttons on the caption bar will be found as well.
hr = pParent->FindAll(TreeScope_Children,pCombinedCondition , &pFound);
metro不再是metro@ClintonWard你知道它的新名字吗