私はメトロアプリを持っています。自動化クライアントを開発しています。メトロアプリのすべての要素を一覧表示したい。
- IApplicationActivationManagerを介してメトロアプリを起動しています
焦点を絞った要素を取得しています
HRESULT hr = Automation-> GetRootElement(&pRoot);
hr=自動化->GetFocusedElement(&pFound);
今、私はボタン、画像要素、その他のようなすべてのコントロールをリストしたかった
自動化インターフェースのFindAllを使用して要素を取得しています。
// 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);
メトロアプリにあるこの唯一のリストボタン。ウィンドウ上のすべてのコントロールを一覧表示したかったのです。
これを手伝ってください。メトロアプリのすべての要素を取得するにはどうすればよいですか?