Re: ATL Compiler Error When Adding Events
On May 1, 10:26 pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:
<wilme...@gmail.com> wrote in message
news:b370952e-5430-4493-9206-9bf3c9164099@q24g2000prf.googlegroups.com
I'm really new to the ATL and I running into an issue when trying to
add event capabilities to a ATL component library.
The error that I got is: error C2039: "OnTrigger": is not a member of
'ICTIXEvents'
Show the code that calls OnTrigger. Was it generated by the wizard? For
a dispinterface, the wizard should have generated a call to
IDispatch::Invoke instead.
However the Generated file CTIXControl1.h that contains the generated
definition of the interface does not show this method
MIDL_INTERFACE("002B6D0B-0D81-46FC-AE17-597728C721AA")
ICTIXEvents: public IDispatch
{
};
This is normal for a dispinterface. Dispinterface methods are not real
methods, they are simply contracts on what DISPIDs are valid for
IDispatch::Invoke call and what parameters should accompany each DISPID.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Thanks very much Igor,
That is good to know, however the compiler is complaining that the
onTriger() does not exist on that interface.
The offending line is hr = pConnection->OnTrigger( Line, EventType);
which is located in the Fire_onTrigger method from the
CProxyICTIEvents class, and this method was generated by the "add
connection point" wizard from Visual Studio.
HRESULT Fire_OnTrigger( short Line, TxEventTypes EventType)
{
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
ICTIXEvents * pConnection = static_cast<ICTIXEvents
*>(punkConnection.p);
if (pConnection)
{
hr = pConnection->OnTrigger(Line, EventType); // <-------
offending line.
}
}
return hr;
}
I'm really confused now since you said that it is normal for the
dispinterface to be be empty. do you know what could be causing this?
Thanks,