When an ActiveX control or COM object generates an event, it makes information about the event available through event parameters. These parameters are stored in the control and can be retrieved by calling C$GETEVENTDATA from the control's event procedure.
CALL "C$GETEVENTDATA" USING EVENT-CONTROL-HANDLE, DEST-ITEM-1, [DEST-ITEM-2, ...] GIVING RESULT-CODE
|EVENT-CONTROL-HANDLE USAGE HANDLE||Handle to the control that generated the event.|
|DEST-ITEM-1 Any COBOL data type||The first destination data item.|
|DEST-ITEM-2, ... Any COBOL data type (optional)||Any number of destination items.|
|RESULT-CODE Signed numeric value||Receives the result-code for the operation. This will be 0 to indicate success or a negative value to indicate failure. (Microsoft defines many standard result codes in their documentation. Note that these are usually in hexadecimal notation.)|
C$GETEVENTDATA converts the event parameters to COBOL-type data in the destination items.
You are responsible for specifying compatible types. For instance, if the event parameter is a character string and you specify a numeric item to receive its value, C$GETEVENTDATA will try to read a number from the string and move it to your numeric item. This is not a programming error and neither the compiler nor runtime will warn you about it.
Suppose you have displayed an ActiveX control that triggers an event called AxEventOne which has three parameters. You would use the following COBOL syntax to get the event parameters into data items PARAM-1, PARAM-2 and PARAM-3:
WHEN AxEventOne CALL "C$GETEVENTDATA" USING EVENT-CONTROL-HANDLE, PARAM-1, PARAM-2, PARAM-3
For more examples of how to get event parameters for ActiveX events, see ActiveX and COM Events.