Windows の [サービス] ウィンドウ ([スタート] -> [ファイル名を指定して実行] -> [Services.msc]) に含まれるリスト項目を見つけようとしています。リスト アイテムの名前は「Arc Service」で、Inspect を使用して簡単に見つけることができますが、私のコードでは見つけることができません。これは比較的単純なケースであるため、何か間違ったことをしているに違いないと感じています。
問題のコードは次のとおりです。
VARIANT arcServiceNameVariant;
VariantInit(&arcServiceNameVariant);
arcServiceNameVariant.vt = VT_BSTR;
arcServiceNameVariant.bstrVal = L"Arc Service";
CComPtr<IUIAutomationCondition> arcServiceNameCondition;
hr = g_pAutomation->CreatePropertyCondition(UIA_NamePropertyId, arcServiceNameVariant, &arcServiceNameCondition.p);
if(SUCCEEDED(hr)) {
CComPtr<IUIAutomationElement> arcServiceElement;
hr = rootElement->FindFirst(TreeScope_Descendants, arcServiceNameCondition, &arcServiceElement.p);
if(SUCCEEDED(hr)) {
if(arcServiceElement.p) {
logInfo(L"Arc Service element found!");
}
} else {
logInfo(L"FindFirst failed!");
}
} else {
logInfo(L"Failed to create property condition!");
}
「アークサービス要素発見!」ブランチは決して入力されません。
要素を説明する Inspect からの詳細は次のとおりです。
どんな援助でも大歓迎です。ありがとう!