model_server/IDE/configshell/cfshell.cxx
///////////////////////////////////////////////////////////
//
// GetClassObject
//   - Create a class factory based on a CLSID.
//
GetClassObject
Create a class factory based on a CLSID.
GetClassObject Create a class factory based on a CLSID .
HRESULT CFactory::GetClassObject(const CLSID& clsid, 
                                 const IID& iid, 
                                 void** ppv)
{
	if ((iid != IID_IUnknown) && (iid != IID_IClassFactory))
	{
		return E_NOINTERFACE ;
	}
	for (int i = 0; i < g_cFactoryDataEntries; i++)
	{
		const CFactoryData* pData = &g_FactoryDataArray[i] ;
		if (pData->IsClassID(clsid))
		{
			*ppv = (IUnknown*) new CFactory(pData) ;
			if (*ppv == NULL)
			{
				return E_OUTOFMEMORY ;
			}
			return NOERROR ;
		}
	}
	return CLASS_E_CLASSNOTAVAILABLE ;
}
HRESULT CFactory :: GetClassObject ( const CLSID & clsid , const IID & iid , void * * ppv ) { if ( ( iid != IID_IUnknown ) && ( iid != IID_IClassFactory ) ) { return E_NOINTERFACE ; } for ( int i = 0 ; i < g_cFactoryDataEntries ; i ++ ) { const CFactoryData * pData = & g_FactoryDataArray [ i ] ; if ( pData -> IsClassID ( clsid ) ) { * ppv = ( IUnknown * ) new CFactory ( pData ) ; if ( * ppv == NULL ) { return E_OUTOFMEMORY ; } return NOERROR ; } } return CLASS_E_CLASSNOTAVAILABLE ; }
GetClassObject
 Create a class factory based on a CLSID.
GetClassObject Create a class factory based on a CLSID .
// Traverse the array of data looking for this class ID. // Found the ClassID in the array of components we can // create. So create a class factory for this component. // Pass the CFactoryData structure to the class factory // so that it knows what kind of components to create.