参考 http://blog.chinaunix.net/u2/66646/showart_673644.html
m_pUnknownInner是从 pCB->NondelegatingQueryInterface(IID_MYIUnknown , (void **)&m_pUnknownInner); 中得来的,
int __stdcall CB::NondelegatingQueryInterface(const int& iid,
void** ppv)
{
//MyTrace say("CB::NondelegatingQueryInterface");
if (iid == IID_MYIUnknown)
{
// !!! CAST IS VERY IMPORTANT !!!
*ppv = static_cast<INondelegatingUnknown*>(this) ; // @N
}
else if (iid == IID_IY)
}
hr = m_pUnknownInner->QueryInterface(IID_IY, (void**)&m_pIY) ; [url=]//@N[/url]
==
(IUnknown *)(INonDelegatingUnknown *)this-> QueryInterface 实际上调用的是NonDelegatingQueryInterface。 |