Sets an event handler for the specified event on an ActiveX controlint sm_com_set_handler(int obj_id, char *event, char *handler);
- An integer handle that identifies the COM component whose method you want to call. The handle is returned through sm_prop_id for ActiveX controls.
- The designated event fired by the ActiveX control.
- The handler to set for the specified event. This can be a prototyped function or a JPL procedure.
sm_com_set_handlersets the handler for the specified event. Refer to the documentation for the ActiveX control to see which events are available.
The ActiveX control can pass parameters as part of the event. If parameters exist, the handler must perform the necessary processing. For an example, open the TreeView ActiveX control in the Panther COM Samples and look at the
The return value from the handler is ignored.
Note: COM components (as opposed to ActiveX controls) normally do not generate events. However, this routine can be used for any COM components that do fire events.
// This C function calls the onURL handler on the
// URLSelected event.
id = sm_prop_id("treeview");
retcode = sm_com_set_handler(id, "URLSelected", "onURL");
}// This is the same JPL procedure.
call sm_com_set_handler(treeview->id, "URLSelected", "onURL")