Call QueryInterface on an Existing Interface Pointer
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
All interfaces implemented in the same co-class are related in such a way that they can be queried from each other by calling the QueryInterface method of the IUknown interface. In the inheritance hierarchy of COM interfaces, IUnknown is the topmost base interface. The method is available on every interface pointer.
The following is a code snippet demonstrating this point.
// Given a valid IUccEndpoint interface pointer
CComPtr<IUccEndpoint> pIUccEndpoint = ...;
// Obtain the IUccServerSignalingSettings interface pointer
CComQIPtr<IUccServerSignalingSettings> spServerSettings;
hr = m_spEndpoint->QueryInterface( &spServerSettings );
if ((FAILED(hr)) || (hr == S_FALSE))
{
// QueryInterface call failed. This could happened if
// the two interfaces were not related.
return hr;
}
In Unified Communications Client API, you can determine the related interfaces by examining the definition of their implementing co-class.
See Also
Concepts
Obtaining Unified Communications Client API Interface Pointers
Obtain an Interface Pointer Through a Co-creatable Co-class
Use a Factory Object to Obtain an Interface Pointer