LresultFromObject

The LresultFromObject function returns a reference, similar to a handle, to the specified object. Servers return this reference when handling WM_GETOBJECT.

LRESULT LresultFromObject(
REFIIDriid,WPARAMwParam,LPUNKNOWNpAcc);

Parameters

  • riid
    [in] Reference identifier of the interface provided to the client. This parameter is IID_IAccessible.
  • wParam
    [in] Value sent by the associated WM_GETOBJECT message in its wParam parameter.
  • pAcc
    [in] Address of the IAccessible interface to the object that corresponds to the WM_GETOBJECT message.

Return Values

If successful, returns a positive value that is a reference to the object.

If not successful, returns one of the following values or another standard COM error code.

Error Description
E_INVALIDARG One or more arguments are invalid.
E_NOINTERFACE The object specified in the pAcc parameter does not support the interface specified in the riid parameter.
E_OUTOFMEMORY Insufficient memory to store the object reference.
E_UNEXPECTED An unexpected error occurred.

Remarks

Servers call this function only when handling the WM_GETOBJECT message. For an overview of how LresultFromObject is related to WM_GETOBJECT, see How WM_GETOBJECT Works.

LresultFromObject increments the object's reference count. If you are not storing the interface pointer passed to the function (that is, you create a new interface pointer for the object each time WM_GETOBJECT is received), call the object's Release method to decrement the reference count back to one. Then the client calls Release and the object is destroyed. For more information, see How to Handle WM_GETOBJECT.

Each time a server processes WM_GETOBJECT for a specific object, it calls LresultFromObject to obtain a new reference to the object. Servers do not save the reference returned from LresultFromObject from one instance of processing WM_GETOBJECT to use as the message's return value when processing subsequent WM_GETOBJECT messages for the same object. This causes the client to receive an error.

Requirements

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

Creating Proxy Objects, How to Handle WM_GETOBJECT, How WM_GETOBJECT Works, WM_GETOBJECT