COM objects can generate events, much like HTML elements generate events. One difference is that the set of events for COM objects is not fixed. The author of a COM class can associate as many different kinds of of events with the class as desired. An HTML event handler traps all events associated with an HTML element. In contrast, a COM event handler traps just one kind of event for a COM object.
As with methods and properties, we rely on COM reflection to learn about events. To get a list of the events that might be generated by the Calendar Control, run
which returns a list of event names. Some events have associated data, so event handler procedures sometimes take one or more arguments. Just as for methods and properties, we can get types for events. The type of an event tells us how many arguments a handler for the event takes. For example,
(com-event-type cal "KeyDown")
returns the type (short-int-box short-int -> void). An event handler for the KeyDown event needs to take two arguments, a boxed ``key code'', indicating which key, and a status flag indicating whether any auxiliary keys, such as Control, were pressed. Like all COM event handlers, which are run for their side effects, the return type is void.
To install a handler for the KeyDown event, we'd run
(com-register-event-handler cal "KeyDown" (lambda (key flags) (printf "key: ~a flags: ~a~n" key flags)))
You now have enough information to get started using MysterX.
There are many sites on the Web that offer ActiveX controls
and other COM components, which you can use with MysterX.
A well-known site is