AccessibleObjectFromWindow

[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
);
 

Parameters

hwnd
Handle to the window whose object interface pointer will be retrieved, or NULL to retrieve information about the mouse pointer (cursor).
dwId
Object ID. This value can be one of the standard object identifier constants or a custom object ID.
riid
Reference identifier of the interface being requested. If the requested interface is not supported, the call will fail and the function will return E_NOINTERFACE.
ppvObject
Address of a variable that will contain the address of the specified interface if the call succeeds.

Return Values

Returns S_OK if successful or another standard COM error code otherwise.

Remarks

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.

See Also

AccessibleObjectFromEvent, AccessibleObjectFromPoint, WinEventProc, IDispatch Interface