Using the TIBCO Moniker in VC++


In C++, the client calls the Win32 MkParseDisplayName function, which returns a moniker. The client then calls the BindToObject method on the moniker to obtain the interface pointer (proxy). The sample.dat project distributed with the adapter contains the following code:

void CreateInstanceThroughMoniker( 
  const _bstr_t& RepoURL,	   // Repository Instance Identifier 
  const _bstr_t& ConfigURL, // Adapter Instance Identifier 
  const _bstr_t& ProgID,    // Programmatic Identifier 
  REFIID refiid,            // IID of desired interface (for 
                               example, ITestobj1) 
  void** ppItf              // Pointer to interface pointer 
) 
{ 
  _ASSERTE(ppItf); 
  *ppItf = NULL; 
  CComPtr<IBindCtx> spBindCtx; 
  HRXBLOCK(CreateBindCtx(0, &spBindCtx);) 
  _bstr_t DisplayName = "tibco"; 
  DisplayName += ":"; 
  DisplayName += RepoURL; 
  DisplayName += "|"; 
  DisplayName += ConfigURL; 
  DisplayName += "|"; 
  DisplayName += ProgID; 
  ULONG cchEaten; 
  CComPtr<IMoniker> spMoniker; 
  HRXBLOCK(MkParseDisplayName(spBindCtx, DisplayName, &cchEaten, 
           &spMoniker);) 
  HRXBLOCK(spMoniker->BindToObject(spBindCtx, NULL, refiid, 
ppItf);) 
} 

TIBCO Adapter™ for COM User’s Guide
Software Release 5.3, September 2005
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com