Retrieving the Object with Keyboard Focus

[This is preliminary documentation and subject to change.]

By using the IAccessible::get_accFocus method, you can retrieve the child object that has keyboard focus. Keep in mind that only one object in the system at a time can have keyboard focus. This method accepts the address of a single VARIANT structure, which it fills to represent the call's result. After making the call, you can look at the value in the structure's vt member to find the result.

If a child object has keyboard focus, then the vt member is set to VT_I4 or VT_DISPATCH. This value tells you whether to look for information in the form of a child ID or an IDispatch interface pointer, held in the lVal or pdispVal members, respectively. If the object had no children with keyboard focus, the vt member will be VT_EMPTY.

Do not confuse object focus with object selection. For more information, see Accessible Object Selection and Focus and Retrieving Selected Objects and Children. For more information about the VARIANT structure, see VARIANT Structure.