Prattaratt
Technical User
I've been working with Borland C++ Builder 5.0 on a TAPI project. Right now I'm trying to figure out the event registration system. I've been able to get a valid (I think it's valid, anyway) IConnectionPointContainer pointer from my CoClass object, but when I use it to try and get an IConnectionPoint pointer, it fails with a E_POINTER error.
Question 1: Do I need to provide the IConnectionPointContainer->FindConnectionPoint function a pointer to an already initialized IConnectionPoint Object?
Question 2: If the answer to question 1 is yes, I'm not real clear on how to Init said pointer, so How to do so?
Here's the code Snippet:
void __fastcall RegTAPIEvents()
{
IConnectionPointContainer * pCPC;
IConnectionPoint * pCP;
IUnknown * pUnk;
HRESULT hr;
// Get the connection point container interface pointer from the TAPI object.
// This works
hr = Form1->MyTAPI1->QueryInterface(
IID_IConnectionPointContainer,
(void **)&pCPC
);
// Get the ITTAPIEventNotification interface pointer from the container.
// this fails with E_POINTER
hr = pCPC->FindConnectionPoint(
IID_ITTAPIEventNotification,
&pCP
);
pCPC->Release();
};
Question 1: Do I need to provide the IConnectionPointContainer->FindConnectionPoint function a pointer to an already initialized IConnectionPoint Object?
Question 2: If the answer to question 1 is yes, I'm not real clear on how to Init said pointer, so How to do so?
Here's the code Snippet:
void __fastcall RegTAPIEvents()
{
IConnectionPointContainer * pCPC;
IConnectionPoint * pCP;
IUnknown * pUnk;
HRESULT hr;
// Get the connection point container interface pointer from the TAPI object.
// This works
hr = Form1->MyTAPI1->QueryInterface(
IID_IConnectionPointContainer,
(void **)&pCPC
);
// Get the ITTAPIEventNotification interface pointer from the container.
// this fails with E_POINTER
hr = pCPC->FindConnectionPoint(
IID_ITTAPIEventNotification,
&pCP
);
pCPC->Release();
};