How Servers Implement Child IDs

Server developers can assign child IDs to both simple elements and accessible objects. However, the recommended approach is to support the standard Component Object Model (COM) interface IEnumVARIANT in every accessible object that has children.

If you implement IEnumVARIANT, you must:

  • Enumerate all children, both simple elements and accessible objects. Provide child IDs for all simple elements and provide the IDispatch to each accessible object.
  • For accessible objects, set the vt member of the VARIANT to VT_DISPATCH. The pdispVal member must contain a pointer to the IDispatch interface. Note that the VARIANT is allocated and freed by the client.
  • For simple elements, the child ID is any 32-bit positive integer. Note that zero and negative integers are reserved by Microsoft Active Accessibility. Set the VARIANT structure vt member to VT_I4 and the lVal member to the child ID.

If you do not support IEnumVARIANT, you must assign child IDs and number the children in each object sequentially starting with one.

It is recommended that clients use the Microsoft Active Accessibility function AccessibleChildren rather than call the server IEnumVARIANT interface directly.