Jeff Horrigan

I'm doing the following


HRESULT hr = CreateObjrefMoniker(pUnk, &pMkr);

LPBC pBctx = NULL;
hr = CreateBindCtx(0, &pBctx);

LPOLESTR displayName;
hr = pMkr->GetDisplayName(pBctx, NULL, &displayName);

and then passing the displayName over to a VBA macro in an instance of Excel I am automatting where

I call GetObject(displayName) to get a reference to my object and it works fine the first time but the second time it fails with "Object not registered" 0x800401fb (even though the object is still valid and up and running). This behavior is not documented (that I can find) and so I'm wondering is this the correct behavior or have I done something wrong

Re: Visual C++ General CreateObjrefMoniker and DisplayName only good for one call to GetObject?

Jeff Horrigan

To answer my own question one time use of the moniker is not the expected behavior. I had a ref count problem and so my object was going away prematurely.