views:

66

answers:

1

Hi, I'm working on a project involving the Microsoft Unified Communications Client API; uccapi.dll. I'm also using Codegear C++Builder 2010, not Visual Studio. After registering the dll with regsvr32 and importing it as type library into C++Builder 2010, uccapi_tlb- and uccapi_ocx-files were generated. When having imported these into my new project I'm trying to follow the msdn guideline for creating a Office Communicator Client able of signing into the Office Communication server.

In this regard I have two questions:

  • What is the correct way of accessing the com-interfaces made available through the ocx?

I've so far found several ways of creating access points, such as.

TCOMIUccPlatform plat;
plat = CoUccPlatform::Create();

and

IUccPlatformPtr im;
im = CreateComObject(CLSID_UccPlatform);

and

IUccPlatform* pIUccPlatform;
hr = CoCreateInstance(CLSID_UccPlatform, 
                      NULL, 
                      CLSCTX_INPROC_SERVER, 
                      __uuidof(IUccPlatform), 
                     (void**)&pIUccPlatform);

and

IUccPlatformPtr pIPlat;
pIPlat.CreateInstance(__uuidof(IUccPlatform));

The three first seem to work well. The latter will give me an Assertion failed: intf!=0 error with 0×40000015 exception. Using any of the three top ones I can access methods and initialize the platform interface.

However when trying any of the same tactics to access any other interface, such as IUccContext, IUccUriManager or IUccUri, all of which have a clsid defined in the _tlb.h file, I either get a "class not registered" error in the first two cases, or a hresult failure in the third case. Which brings me to my next question.

  • Using ole-viewer all interfaces are registered as they should. Why wouldn't all co-creatable classes in the dll be registered when registering the dll? And what could be the reasons why don't they act similarly?

*Edit1 from UCCAPILib_tlb.h:*

// 
// COCLASS DEFAULT INTERFACE CREATOR
// CoClass  : UccPlatform
// Interface: TCOMIUccPlatform
//
typedef TCoClassCreatorT<TCOMIUccPlatform, IUccPlatform, &CLSID_UccPlatform, &IID_IUccPlatform> CoUccPlatform;
// 
// COCLASS DEFAULT INTERFACE CREATOR
// CoClass  : UccUriManager
// Interface: TCOMIUccUriManager
// 
typedef TCoClassCreatorT<TCOMIUccUriManager, IUccUriManager, &CLSID_UccUriManager, &IID_IUccUriManager> CoUccUriManager;
+1  A: 

This issue is already being discussed in detail in the Embarcadero forums.

Remy Lebeau - TeamB
discussed and solved. And the OP's question is word for word identical so it was copy and pasted from the above link.
gbrandt