In C++/CLI you cannot directly access an event in that manner. In C# you do need to check for null and thus you need to have access to the event. But C++/CLI will generate code in the event-raise handler that will check for null.
Second issue is you cannot directly assign to the event like that. You can only subscribe to the event using +=. I've fixed your code example as follows:
public ref class MyClass
{
public:
delegate bool delOnEnum(int h);
event delOnEnum ^OnEnum;
bool handler(int h)
{
System::Console::WriteLine("Found a new window {0}", h);
return true;
}
MyClass()
{
OnEnum += gcnew delOnEnum(this, &MyClass::handler);
}
void Foo()
{
OnEnum(16);
}
};