正在加载图片...
包容:外部对象类厂的实现 HRESULT CBFactory:: CreateInstance (IUnknown pUnknownOuter st IID& id, void **ppv) CBpobji HRESULT hr;*=NULLi if(pUnknownOuter != NULL) return CLASS__NOAGGREGATION pobj=new CB Or if (pobj== NULL)return E_OUTOFMEMORY; hr= pobj->InitOF if( FAILED(hr))t g ObjectNumber delete pobji } //obtain the first interface pointer(which does an AddRef) hr=pObj->Query Interface(id, ppv)i return hri包容:外部对象类厂的实现 包容:外部对象类厂的实现 HRESULT HRESULT CBFactory CBFactory::CreateInstance CreateInstance (IUnknown IUnknown *pUnknownOuter pUnknownOuter, const IID& const IID& iid, void ** , void **ppv ) { CB *pObj; HRESULT hr; HRESULT hr; *ppv=NULL; if (pUnknownOuter pUnknownOuter != NULL) return CLASS_E_NOAGGREGATION; != NULL) return CLASS_E_NOAGGREGATION; pObj=new CB (); =new CB (); if (pObj == NULL) return E_OUTOFMEMORY; == NULL) return E_OUTOFMEMORY; hr = pObj->Init(); ->Init(); if (FAILED(hr) ) { if (FAILED(hr) ) { g_ObjectNumber ObjectNumber --; delete pObj; } //Obtain the first interface pointer (which does an //Obtain the first interface pointer (which does an AddRef ) hr=pObj->QueryInterface QueryInterface (iid, ppv); return hr; return hr; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有