Following code does not work as expected, i.e. returned element does not implement Dock pattern. Is it FindFirst API limitation or bug?
CoInitializeEx(NULL, COINIT_MULTITHREADED); CComPtr<IUIAutomation> automation_ptr; HRESULT hr = automation_ptr.CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER); IUIAutomationElement *root_element_ptr; hr = automation_ptr->GetRootElement(&root_element_ptr); VARIANT prop; prop.vt = VT_BOOL; prop.boolVal = 1; IUIAutomationCondition* condition_ptr; hr = automation_ptr->CreatePropertyCondition(UIA_IsDockPatternAvailablePropertyId, prop, &condition_ptr); IUIAutomationElement* element_ptr = NULL; hr = root_element_ptr->FindFirst(TreeScope_Descendants, condition_ptr, &element_ptr); VARIANT check; hr = element_ptr->GetCurrentPropertyValue(UIA_IsDockPatternAvailablePropertyId, &check);