@@ -49,13 +49,29 @@ static BSTR g_bstrs[3] = {
4949
5050HRESULT GetWidthOfChildren (BOOL vertical, IUIAutomationElement *taskList, UINT &result)
5151{
52- CComPtr<IUIAutomationCondition> buttonCond;
53- CHK_HR (g_pUI->CreatePropertyCondition (UIA_ControlTypePropertyId,
54- CComVariant{ UIA_ButtonControlTypeId }, &buttonCond));
52+ static const long buttonVariants[] = {
53+ UIA_ButtonControlTypeId,
54+ UIA_MenuItemControlTypeId
55+ };
56+
57+ IUIAutomationCondition* conditions[2 ]{ nullptr , nullptr };
58+ SCOPE_EXIT{ for (int i = 0 ; i < 2 ; ++i) RELEASE (conditions[i]); };
59+ for (int i = 0 ; i < 2 ; ++i)
60+ {
61+ Z_PTR (IUIAutomationCondition, prop);
62+ CHK_HR (g_pUI->CreatePropertyCondition (
63+ UIA_ControlTypePropertyId, CComVariant{ buttonVariants[i] },
64+ &prop));
65+ conditions[i] = prop;
66+ }
67+
68+ CComPtr<IUIAutomationCondition> orCondition;
69+ CHK_HR (g_pUI->CreateOrConditionFromNativeArray (
70+ conditions, 2 , &orCondition));
5571
5672 CComPtr<IUIAutomationElementArray> children;
5773 CHK_HR (taskList->FindAll (TreeScope_Children,
58- buttonCond , &children));
74+ orCondition , &children));
5975
6076 INT length;
6177 CHK_HR (children->get_Length (&length));
0 commit comments