HY!

I have a problem hooking an event. I get an compiler error, that my callback
isn´t a memeber of the containing class. I canßt find anything I am doing
wrong.
I found a small coed example which reproduces the compiler error.

[object, uuid("99BE5DDB-0661-496E-BA84-8DE522E817C9"), dual, oleautomation]
__interface ITest
{



};


[dispinterface, uuid("C3D67614-608A-44D1-BA7D-9586A21C14F4")]
__interface ITestEvents
{
[id(1)]
HRESULT TestEvent([in] ITest *pITest);


};


[coclass, uuid("D3EDEB8D-0756-4705-B167-3939DD480DF3"), event_source(com),
event_receiver(com)]
class ATL_NO_VTABLE Test : public ITest
{
BEGIN_COM_MAP(Test)
COM_INTERFACE_ENTRY(ITest)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

__event __interface ITestEvents;


public:
HRESULT OnTestEvent(ITest *pITest)
{
return S_OK;
}


HRESULT FinalConstruct()
{
__hook(&ITestEvents::TestEvent, static_cast<ITest*>(this),
&Test::OnTestEvent);
return S_OK;
}



};


I see the compiler error "error C2039: 'OnTestEvent' : is not a member of
'Test'". Anyone else with the same error?


Anybody got a good hint for me what is wrong?

Ronny

Re: __hook - C2039 - is not a member of by Brian

Brian
Mon Dec 10 11:23:50 PST 2007

I can't see the beginning of this thread, so I'm not sure if my comments are relevant to the discussion at hand. I just happened to
notice you are using attributed ATL, which has a history of being buggy. I strongly recommend that you switch to unattributed ATL.
Most of the experts in the microsoft.public.vc.atl group have long since given up on attributed ATL, or have been burnt trying to
use it.

Regards,

Brian