I have a Metro app. I am developing a automation client. I want to List All Element of the Metro App.
- I am Launching the metro App through IApplicationActivationManager
-
I am getting the focussed element
HRESULT hr = automation->GetRootElement(&pRoot);
hr = automation->GetFocusedElement(&pFound);
Now I wanted to List All the Control like button, Picture element and Other
I am Using FindAll of automation Interface to get element ,
// 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);
This Only List Button there in the metro app.
I wanted to List all the control on the Window.
Please help on this. How Can Get All Element of a Metro App?
I find it out ……If we use true condition we can find all element on UI