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.
Opinia
https://aka.ms/ContentUserFeedback.
Dostępne już wkrótce: W 2024 r. będziemy stopniowo wycofywać zgłoszenia z serwisu GitHub jako mechanizm przesyłania opinii na temat zawartości i zastępować go nowym systemem opinii. Aby uzyskać więcej informacji, sprawdź:Prześlij i wyświetl opinię dla