COM 组件多层聚合嵌套原理
2010-12-05 08:10:50 来源:WEB开发网核心提示: NondelegationQueryInterface:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 HRESULT CC::NondelegationQuery
NondelegationQueryInterface:
1 HRESULT CC::NondelegationQueryInterface(const IID& iid, void **ppv)
2 {
3 printf("---------------------excute CompC NondelegationQueryInterface!!!\n");
4 if ( iid == IID_IUnknown )
5 {
6 *ppv = (INondelegatingUnknown *) this ;
7 ((IUnknown *)(*ppv))->AddRef() ;
8 } else if ( iid == IID_AnyInterface )
9 {
10 *ppv = (IAnyInterface *) this ;
11 ((IAnyInterface *)(*ppv))->AddRef() ;
12 } else if ( iid == IID_SomeInterface )
13 {
14 return m_pUnknownInner->QueryInterface(iid, ppv) ;
15 } else if ( iid == IID_OtherInterface )
16 {
17 return m_pUnknownOuter->QueryInterface(iid, ppv) ;
18 } else
19 {
20 *ppv = NULL;
21 return E_NOINTERFACE ;
22 }
23 return S_OK;
24 }
2 {
3 printf("---------------------excute CompC NondelegationQueryInterface!!!\n");
4 if ( iid == IID_IUnknown )
5 {
6 *ppv = (INondelegatingUnknown *) this ;
7 ((IUnknown *)(*ppv))->AddRef() ;
8 } else if ( iid == IID_AnyInterface )
9 {
10 *ppv = (IAnyInterface *) this ;
11 ((IAnyInterface *)(*ppv))->AddRef() ;
12 } else if ( iid == IID_SomeInterface )
13 {
14 return m_pUnknownInner->QueryInterface(iid, ppv) ;
15 } else if ( iid == IID_OtherInterface )
16 {
17 return m_pUnknownOuter->QueryInterface(iid, ppv) ;
18 } else
19 {
20 *ppv = NULL;
21 return E_NOINTERFACE ;
22 }
23 return S_OK;
24 }
更多精彩
赞助商链接