CoCreateInstance(CLSID_MyObject,
NULL,
CLSCTX_INPROC_SERVER,
IID_IMyObject,
(void**)&m_pIMyObject);
ISomeObject* pISomeObject = NULL;
if (pIClassFactory)
{
pIClassFactory->CreateInstance (NULL,
IID_ISomeObject,
(LPVOID*)&pISomeObject);
pIClassFactory->Release();
pIClassFactory = NULL;
}