[This is preliminary documentation and subject to change.]
Retrieves the address of a specified interface for a given object.
STDAPI AccessibleObjectFromWindow(
HWND hwnd,
DWORD dwId,
REFIID riid,
void **ppvObject
);
Returns S_OK if successful or another standard COM error code otherwise.
Clients can call this function to retrieve addresses of an object's IAccessible, IDispatch, IEnumVARIANT, IUnknown, or other supported interface. If the requested interface is not supported, the function returns E_NOINTERFACE.
In some cases, this function might create and return a pseudo-object as a wrapper for windows that do not provide accessible objects themselves.
This function increases an object's reference count, and must have a corresponding 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 Word does with its objects when it shuts down: As with a standard OLE Automation object, 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 of the application.
AccessibleObjectFromEvent, AccessibleObjectFromPoint, WinEventProc, IDispatch Interface