It sets up an event handler for an automation object.
int SetEventHandlerForObject( Object * pObj, LPCSTR lpcszEventName, Function * pOCFunc )
0 if the event handler was set up successfully, 2 if an events COM interface cannot be retrieved from the object, 3 if the event name was wrong.
// This is the event handler which catches the event. The prototype must agree
// with the event's declaration, which can be found out by inspecting
// the object library for each particular object.
// Declare a function object (the function MyEventHandler must
// have been defined before)
Object obj = CreateObject("SomeObject.SomeObject");
// This sets up the event handler. It tells the object obj: Call the function
// MyEventHandler when event "SomeEvent" happens.
iRet = SetEventHandlerForObject(&obj, "SomeEvent", &fnEventHandler);
if (0 == iRet)
out_str("Event handler set up successfully.");