Share via


The IAccessible::get_accState method retrieves the current state of the specified object. All objects support this property.

HRESULT get_accState(
  VARIANT* pvarState


  • varID
    [in] Specifies whether the state information retrieved is that of the object or of one of the object's child elements. This parameter is either CHILDID_SELF (to obtain information about the object) or a child ID (to obtain information about the object's child element). For more information about initializing the VARIANT structure, see How Child IDs Are Used in Parameters.
  • pvarState
    [out, retval] Address of a VARIANT structure that receives information that describes the object's state. The vt member is VT_I4 and the lVal member is one or more of the object state constants.

Return Values

If successful, returns S_OK.

If not successful, returns one of the following values or another standard COM error code. Although servers return these values, clients must always check output parameters to ensure that they contain valid values. For more information, see Checking IAccessible Return Values.

Error Description
E_INVALIDARG An argument is invalid.


If predefined state values are returned, clients call GetStateText to retrieve a localized string that describes the object's state.

The state of a child is dependent on the state of its ancestors. For example, if a user dismisses a dialog box, a child object (such as an edit control or a push button) is not available to the user. However, get_accState will return an available state for the children of the dialog. To verify the state information of a child object, call get_accState for the parent object.

Note to server developers  You must use the predefined state constants.


**  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

GetStateText, State Property, VARIANT Structure, Object State Constants