Catherine,
I assume that by "raising an event" you mean invoking a delegate? The
following code shows how you can invoke a delegate in unmanaged code:
------------------------------------------------------------------------
#using <mscorlib.dll>
using namespace System;
__delegate void TestEventHandler();
class UnmanagedClass {
public:
void doSomething(TestEventHandler *testEventHandler);
};
void UnmanagedClass::doSomething(TestEventHandler *testEventHandler) {
testEventHandler->Invoke();
}
__gc class ManagedClass {
public private:
void testEventOccurred() {
Console::WriteLine(S"It happened!");
}
};
int _tmain()
{
UnmanagedClass unmanagedClass;
ManagedClass *managedClass = new ManagedClass();
unmanagedClass.doSomething(new TestEventHandler(managedClass,
ManagedClass::testEventOccurred));
return 0;
}
------------------------------------------------------------------------
> Dear All
> Please help me in the following issue:
[quoted text clipped - 6 lines]
> Also the event receiver method should not be static.
> Thank you very much for your understanding.
Catherine Jones - 11 Dec 2003 11:28 GMT
Thanx Bart, I got an idea from your code.
Thanx a lot for your time and understanding!
> Catherine,
>
[quoted text clipped - 44 lines]
> > Also the event receiver method should not be static.
> > Thank you very much for your understanding.