GotUC.Net
GotUC.Net - your developer resource for Microsoft Office Communications Server

Class Not Registered error

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

Top 10 Contributor
Male
10 Posts
Arjun posted on 01-11-2010 11:47 PM

Hi All,

 

I  am  getting  claas not registered while creating the object through CoCresteInstance

 HRESULT hr = CoCreateInstance(  __uuidof(UccUriManager), NULL,  CLSCTX_LOCAL_SERVER,  __uuidof(IUccUriManager),   (LPVOID *)&m_spUriManager  );

UccUriManager -- i am getting as not found. when i click on go to definition its navigating to uccapi.h


#ifdef __cplusplus
typedef class UccUriManager UccUriManager;
#else


(Sample example from UCCAPI is working fine, i am getting error in my example. I have followed same procedure as in same example.) 

pls let me know what is causing the error.



Thanks,
Arjun.

All Replies

Top 10 Contributor
Male
10 Posts

hi, I solved the problem by adding following code.

when i get class not registered error i will call this function which will load the dll and register succesfully.

HRESULT CUALoginUnitApp::MyCoCreateInstance(
  LPCTSTR szDllName,
  IN REFCLSID rclsid,
  IUnknown* pUnkOuter,
  IN REFIID riid,
  OUT LPVOID FAR* ppv)
{
  HRESULT hr = REGDB_E_KEYMISSING;

  HMODULE hDll = ::LoadLibrary(szDllName);
  if (hDll == 0)
    return hr;

  typedef HRESULT (__stdcall *pDllGetClassObject)(IN REFCLSID rclsid,
                   IN REFIID riid, OUT LPVOID FAR* ppv);

  pDllGetClassObject GetClassObject =
     (pDllGetClassObject)::GetProcAddress(hDll, "DllGetClassObject");
  if (GetClassObject == 0)
  {
    ::FreeLibrary(hDll);
    return hr;
  }

  IClassFactory *pIFactory;

  hr = GetClassObject(rclsid, IID_IClassFactory, (LPVOID *)&pIFactory);

  if (!SUCCEEDED(hr))
    return hr;

  hr = pIFactory->CreateInstance(pUnkOuter, riid, ppv);
  pIFactory->Release();

  return hr;
}

 

Thanks,

Arjun.

Page 1 of 1 (2 items) | RSS
Copyright © 2009 - GotUC.Net
Powered by Community Server (Commercial Edition), by Telligent Systems