Programming Guide |
Sets an event handler for the specified event on an ActiveX control
int sm_com_set_handler(int obj_id, char *event, char *handler);
obj_id
- 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.
event
- The designated event fired by the ActiveX control.
handler
- The handler to set for the specified event. This can be a prototyped function or a JPL procedure.
Windows, Web
Client
sm_com_set_handler
sets 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
node_click
procedure.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.
#include <smuprapi.h>
int id;
int retcode;
{
id = sm_prop_id("treeview");
retcode = sm_com_set_handler(id, "URLSelected", "onURL");
}// This is the same JPL procedure.
vars retcode
call sm_com_set_handler(treeview->id, "URLSelected", "onURL")
proc onURL
...
return