AccessibleChildren

The AccessibleChildren function retrieves the child ID or IDispatch interface of each child within an accessible container object.

STDAPI AccessibleChildren(
  IAccessible* paccContainer,
  LONG iChildStart,
  LONG cChildren,
  VARIANT* rgvarChildren,
  LONG* pcObtained
);

Parameters

  • paccContainer
    [in] Pointer to the container object's IAccessible interface.
  • iChildStart
    [in] Specifies the zero-based index of the first child retrieved. This parameter is an index, not a child ID. Typically, this parameter is set to zero (0).
  • cChildren
    [in] Specifies the amount of children to retrieve. An application calls IAccessible::get_accChildCount to retrieve the current number of children.
  • rgvarChildren
    [out] Pointer to an array of VARIANT structures that receives information about the container's children. If the vt member of an array element is VT_I4, then the lVal member for that element is the child ID. If the vt member of an array element is VT_DISPATCH, then the pdispVal member for that element is the address of the child object's IDispatch interface.
  • pcObtained
    [out] Address of a variable that receives the number of elements in the rgvarChildren array filled in by the function. This value is the same as the cChildren parameter, unless you ask for more children than the number that exist. Then, this value will be less than cChildren.

Return Values

If successful, returns S_OK.

If not successful, returns one of the following or another standard COM error code.

Error Description
E_INVALIDARG An argument is invalid.
S_FALSE The function succeeded, but the number of array elements in rgvarChildren is fewer than the number of children requested in cChildren.

Remarks

To retrieve information about all of the children in a container, the parameter iChildStart must be zero (0), and cChildren must be the value returned by IAccessible::get_accChildCount.

When calling this function to obtain information about the children of a user interface element, it is recommended that clients obtain information about all of the children. For example, iChildStart must be zero (0), and cChildren must be the value returned by IAccessible::get_accChildCount.

If a child ID is returned for an element, then the container must provide information about the child element. To obtain information about the element, clients use the container's IAccessible interface pointer and specify the obtained child ID in calls to the IAccessible properties.

Clients must call the Release method for any IDispatch interfaces retrieved by this function, and free the array when it is no longer required.

Requirements

**  Windows NT/2000/XP/Server 2003:** Included in Windows 2000 and later.
**  Windows 95/98/Me:** Included in Windows 98 and later.
**  Redistributable:** Requires Active Accessibility 1.3 RDK on Windows NT 4.0 SP6 and Windows 95.
**  Header:** Declared in Oleacc.h.
**  Library:** Use Oleacc.lib.

See Also

IAccessible, VARIANT Structure, IDispatch Interface