[This is preliminary documentation and subject to change.]
Retrieves the address of the IAccessible interface for an object that generated a given event.
STDAPI AccessibleObjectFromEvent(
HWND hwnd,
DWORD dwId,
DWORD dwChildId,
IAccessible** ppacc,
VARIANT* pvarChild
);
Returns S_OK if successful or a standard COM error code otherwise. When the idObject parameter identifies a system object, oleacc.dll checks for a valid idChild value. However, if the object identified by the idObject parameter is not a system object, the server is responsible for returning failure when the idChild parameter is invalid.
Clients call this function to retrieve a specific child object that generated an event. The client uses the parameters sent to its WinEventProc callback function to fill this function's parameters.
This function retrieves the lowest-level accessible object that is associated with an event. If the child that generated the event is not an accessible object (that is, does not support IAccessible), then the function returns that child's parent. The parent is assumed to support the functionality extended by the IAccessible interface on the child's behalf.
This function increases an object's reference count, and must have a corresponding call to Release. Even though an object has a reference count greater than zero, that object can still be destroyed, and clients are not guaranteed that getting properties from or calling methods on an object will succeed. This is what Microsoft® Word does with its objects when it shuts down: As with standard OLE Automation objects, Word will quit and CoDisconnect the object so that if anyone tries to access it cross-process after the quit, OLE will return an error. A reference count on a OLE Automation object does not affect the reference count in the application.
AccessibleObjectFromPoint, AccessibleObjectFromWindow, WinEventProc, VARIANT Structure