Create New Interfaces to the Same Object
In this scenario, the server responds to each OBJID_CLIENT request by obtaining a new interface pointer to the same object.
In the following example code, m_pUIObj is a pointer to an object that supports more than one Component Object Model (COM) interface. Even though an existing object is reused, a new interface pointer is created each time the object is retrieved, so the reference count must be decremented.
case WM_GETOBJECT:
if ((DWORD)lParam == OBJID_CLIENT)
{
// Get a new interface to the same object.
IAccessible *pAcc = NULL;
// The following increments the reference count.
m_pUIObj->QueryInterface(IID_IAccessible, (LPVOID*)&pAcc);
LRESULT lAcc = LresultFromObject(IID_IAccessible, wParam,
(LPUNKNOWN) &pAcc);
// Release our reference to the object.
pAcc->Release();
return lAcc;
}
break; // Fall through to DefWindowProc.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for