Hello again,
I have some problems with my implementation of IConnectionPointContainer and IConnectionPoint. Actually the IConnectionPointContainer works like it should but the IConnectionPoints seems to not get the input it likes when my .NET-application adds an event to the point.
The problem occurs in my implementation of IConnectionPoint::Advise. According to the MSDN the IUnknown supplied as an argument should support the interface represented by this connection point. But calling QueryInterface on that IUnknown always gives me
E_NOINTERFACE
. I displayed the IID requested in the IConnectionPointContainer (in FindConnectionPoint) and compared it to the IID i pass to QueryInterface in IConnectionPoint::Advise and they are the same.
Here with some code:
IConnectionPointContainer::FindConnectionPoint:
STDMETHOD(FindConnectionPoint)(REFIID iid, IConnectionPoint** ppConnPtr)
{
if(ppConnPtr == NULL)
return E_POINTER;
if(mConnectionPoints.find(iid) == mConnectionPoints.end())
return CONNECT_E_NOCONNECTION;
*ppConnPtr = mConnectionPoints[iid];
mConnectionPoints[iid]->AddRef();
return S_OK;
}
Outputs show me that the connection point is successfully found.
IConnectionPoint::Adivse (just the start)
STDMETHOD(Advise)(IUnknown* pUnkSink, DWORD* pdwToken)
{
std::cout << __FUNCTION__ << std::endl;
if(!pdwToken)
{
std::cout << "return E_POINTER;" << std::endl;
return E_POINTER;
}
*pdwToken = 0;
T* connObj = NULL;
if(FAILED(pUnkSink->QueryInterface(&connObj))) {
std::cout << "return CONNECT_E_CANNOTCONNECT;" << std::endl;
return CONNECT_E_CANNOTCONNECT;
}
...
}
Anyone got a clue why this is happening or if i understood something wrong in the MSDN?
Thanks a lot,
Regner