B
bonk
Hello,
I have a managed type that defines an Event as one of its public
members. Is it possible for an unmanaged c++ class to register to that
event ? How can an unmanaged classmethod be called as a response to a
raised event ?
Within my unmanaged class I tried to following:
void MyUnManagedClass::InitializeAndRegister ()
{
RefClass^ rc = gcnew RefClass();
rc->SomeEvent += gcnew SomeEventHandlerDelegate
(this,&MyUnManagedClass::OnEvent);
}
void MyUnManagedClass::OnEvent()
{
// do something as a response to the event here
}
unfortuantely I get the compilererror: C3364 : delegate constructor
argument must be pointer to memeber function of managed class or global
function
does that mean only managed classes can register themselfes to an event?
If so, do you see any workaround to make unmanaged classes register
respond to events?
Do you have a simple example ?
I have a managed type that defines an Event as one of its public
members. Is it possible for an unmanaged c++ class to register to that
event ? How can an unmanaged classmethod be called as a response to a
raised event ?
Within my unmanaged class I tried to following:
void MyUnManagedClass::InitializeAndRegister ()
{
RefClass^ rc = gcnew RefClass();
rc->SomeEvent += gcnew SomeEventHandlerDelegate
(this,&MyUnManagedClass::OnEvent);
}
void MyUnManagedClass::OnEvent()
{
// do something as a response to the event here
}
unfortuantely I get the compilererror: C3364 : delegate constructor
argument must be pointer to memeber function of managed class or global
function
does that mean only managed classes can register themselfes to an event?
If so, do you see any workaround to make unmanaged classes register
respond to events?
Do you have a simple example ?