I'm trying to create an ATL component which listens for events from an application API (Trayport Global Vision) but it's throwing an exception. Note: I'm working in VC++ 6.0.

Info about the problem:
-----------------------------------
I can successfully create an instance of the Global Vision API with the line:

HRESULT hr = m_pGV8Api.CoCreateInstance( CLSID_GlobalVision8API );

however when I try to connect to it to listen to events with the line:
hr = DispEventAdvise(m_pGV8Api,&DIID__IGlobalVision8APIEvents);

it throws an exception. I've commented out all of my catch(...) clauses so I could see what the exception is and it is 0xC0000005: Access Violation (GV8API.dll).

I'm not sure why it's throwing this exception, the gv8api.dll is in the working directory (of the code) and I include <gv8api.h> in the relevant classes.

When I step into (debug) the line:

hr = DispEventAdvise(m_pGV8Api,&DIID__IGlobalVision8APIEvents);

It goes into the following subroutine:

//Helpers for sinking events on random IUnknown*
HRESULT DispEventAdvise(IUnknown* pUnk, const IID* piid)
{
ATLASSERT(m_dwEventCookie == 0xFEFEFEFE);
return AtlAdvise(pUnk, (IUnknown*)this, *piid, &m_dwEventCookie);
}

and then

ATLINLINE ATLAPI AtlAdvise(IUnknown* pUnkCP, IUnknown* pUnk, const IID& iid, LPDWORD pdw)
{
CComPtr<IConnectionPointContainer> pCPC;
CComPtr<IConnectionPoint> pCP;
HRESULT hRes = pUnkCP->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);
if (SUCCEEDED(hRes))
hRes = pCPC->FindConnectionPoint(iid, &pCP);
if (SUCCEEDED(hRes))
hRes = pCP->Advise(pUnk, pdw);
return hRes;
}

When I step off the line: hRes = pCP->Advise(pUnk, pdw); the exception is thrown.

I'm completely new to C Plus Plus so it could be something really fundamental, any help would be greatly appreciated.

Thanks.