IUIAutomation2::put_AutoSetFocus method (uiautomationclient.h)
Specifies whether calls to UI Automation control pattern methods automatically set focus to the target element.
This property is read/write.
HRESULT put_AutoSetFocus( BOOL autoSetFocus );
By default, most UI Automation methods that perform an action on an element, such as IUIAutomationInvokePattern::Invoke and IUIAutomationValuePattern::SetValue, set focus to the element before performing the action. For most applications, setting the focus results in a more consistent user experience. In situations where setting the focus would be disruptive, such as automating a drop-down menu, you can set AutoSetFocus to FALSE to prevent UI Automation methods from setting the focus.
|Minimum supported client||Windows 8 [desktop apps only]|
|Minimum supported server||Windows Server 2012 [desktop apps only]|
|Header||uiautomationclient.h (include UIAutomation.h)|