473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

__hook - C2039 - is not a member of

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
Dec 7 '07 #1
2 2310

"Masterchief" <ro*********@kapsch.netwrote in message
news:ur**************@TK2MSFTNGP02.phx.gbl...
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?
The group for native development is microsoft.public.vc.language.

Have you tried using a static member function?
>
Ronny
Dec 7 '07 #2
Hy!

Yes. I have. I also changend the calling convention to __stdcall.
Nothing helps.

Ronny

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamschrieb im Newsbeitrag
news:5F**********************************@microsof t.com...
>
"Masterchief" <ro*********@kapsch.netwrote in message
news:ur**************@TK2MSFTNGP02.phx.gbl...
>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?

The group for native development is microsoft.public.vc.language.

Have you tried using a static member function?
>>
Ronny

Dec 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bragadiru | last post by:
I tried to use : System::String* outFile = System::IO::Path::GetTempFileName(); but I get this compile error: error C2039: 'GetTempFileNameA' : is not a member of 'System::IO::Path' I found...
0
by: hantheman | last post by:
Hi, I have a few __hook calls to handle COM events in an event_receiver. However, the call to __hook throws an unknown exception. I can query the connection point just fine, but the hooking...
4
by: mccoyn | last post by:
I have a class exported in a dll that has member variables I wish to access. When I do it I get an error C2039: 'myVar' : is not a member of myClass Here is an example of what my code looks like...
1
by: Daniel Wilson | last post by:
I have a project that I have upgraded from VC++.Net 2002 to 2003. It worked fine under 2002. I have solved some of the issues, but now am getting C:\dwilson\StitchViewer\Stitch2Image.cpp(165):...
0
by: Pekka Puro | last post by:
In event source side i have: namespace NXmlParser { public __gc class CXmlParser { public: /** * Class constructor
0
by: Shashikiran Prabhakar via .NET 247 | last post by:
(Type your message here) Hi, I am not very conversent in VC++, but the requirement for me is to run a rendering code. However i am encountering the following errors. c:\Program...
3
by: test | last post by:
Hey everyone. I'm just trying out some of our code to see if it is even possible to think about moving to VC8. Apart from a few minor problems in our stuff (to do with wrong for loop scoping...
4
by: jewel87 | last post by:
Hello, I have a problem in the following code: OutputFile.clear(); OutputFile.seekg(0); The compiler (Visual Studio) gives an error message: error C2039: 'seekg' : is not a member of...
0
by: yyuan168a | last post by:
I'm upgrading a VS2003 project to VS2005 but got bunch of C2039 errors in xutility.h file during compiling: :\Program Files\Microsoft Visual Studio 8\VC\include\xutility(610) : error C2039:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.