How to Handle WM_GETOBJECT
When it receives a WM_GETOBJECT message that contains OBJID_CLIENT, the server must return a pointer to the object that implements IAccessible. This pointer is an LRESULT that is obtained by calling LresultFromObject. Active Accessibility, in conjunction with the COM library, performs the appropriate marshaling and passes the IAccessible interface pointer from the server to the client.
Servers must correctly handle reference counting on the accessible object. Remember that when you create a COM object, the reference count is 1. LresultFromObject then further increments the reference count several times. All the references created by LresultFromObject are automatically released when the object is no longer needed, but the server is responsible for releasing the initial reference, and unless it does so, the object will never be destroyed. The examples in the following sections show how to release references to accessible objects.
Servers typically handle WM_GETOBJECT in one of the following ways:
- Creating new accessible objects
- Reusing existing pointers to objects
- Creating new interfaces to the same object
Note In this section as in the rest of the documentation, when a pointer to an IAccessible interface is discussed, this pointer may actually be a pointer to a proxy object that wraps the IAccessible interface. For more information about proxy objects, see Creating Proxy Objects.
For an overview of WM_GETOBJECT, see How WM_GETOBJECT Works.