Object and Child Identifiers

[This is preliminary documentation and subject to change.]

Active Accessibility identifies user interface elements by using object and child identifiers. These values, by themselves, mean little to a client, and clients aren't expected to decipher them. Rather, clients use these values when calling functions that retrieve the object itself. Active Accessibility provides the AccessibleObjectFromEvent, AccessibleObjectFromWindow, and AccessibleObjectFromPoint functions for this purpose.

The terms "object identifier" and "object ID" refer to a 32-bit value that uniquely identifies an accessible object within an application. Often these values refer to standard top-level objects in a window, like the application menu or scroll bars. Active Accessibility reserves all negative values and zero to use as these standard object identifiers. However, server applications can use any positive, nonzero object ID values to identify other objects they contain.

Child identifiers take one of two forms: a 32-bit integer value or a name string, each uniquely identifying a child within the container's scope. (For simplicity in this document, the term "child ID" refers only to the 32-bit value.) Child identifiers can take strings, object identifiers do not. In effect, child identifiers describe simple elements within an accessible object; that is, they describe elements that don't support Active Accessibility, but are contained by a parent that does. If an object provides information about itself, but not about a child element, it specifies the CHILDID_SELF value, defined as zero in the winable.h header file.

The IAccessible interface provides methods that enable clients to request information about an object or navigate using object and child identifiers. Remember that server applications might support only one of the two child identification methods. For example, if a client calls IAccessible methods by using name strings to identify an object's children but the server supports only 32-bit child IDs, the method will fail and return the E_INVALIDARG error code.

Server applications can use whichever method they choose. However, if a server supports child IDs, it must follow some basic rules. Server applications using child ID values can assign any 32-bit value, so long as they support the IEnumVARIANT interface, which enables clients to logically enumerate child objects regardless of their child IDs. For more information on the IEnumVARIANT interface, see the Platform SDK. If the server application doesn't support IEnumVARIANT, child ID values must be sequential integers starting with 1.