Classes

Method ActiveXObject():subscribeEvent() Foundation

Subscribes to a COM/ActiveX event.

Syntax
:subscribeEvent( <nDISPID>, <bHandler>, [<cGUID>] ) --> lSuccess
Parameters
<nDISPID>
<nDISPID> is a numeric value that specifies the numeric dispatch ID (DISPID) of the event to be subscribed to.
<bHandler>
<bHandler> contains a code block to be associated with the COM/ActiveX event.
<cGUID>
<cGUID> is a character string that specifies the globally unique identifier (GUID) of a COM event interface. This parameter is optional.
Return

:subscribeEvent() returns a logical value. If the event identified by the dispatch ID in <nDISPID> is subscribed, the value .T. (true) is returned. Otherwise, :subscribeEvent() returns .F. (false).

Description

The method :subscribeEvent() subscribes to the COM/ActiveX event specified via the <nDISPID> parameter. After the event is subscribed by the ActiveXObject, the code block passed in parameter <bHandler> is called automatically when the event is fired by the ActiveX object connected. To remove the association established by this method, an application uses the method :unsubscribeEvent().

To verify whether the event is supported by the connected COM/ActiveX object, :subscribeEvent() automatically checks all COM event interfaces published by the COM/ActiveX component. Therefore, parameter <cGUID> need not be specified by the Xbase++ application unless an event interface cannot be addressed for any reason.

The method :subscribeEvent() is used internally by the event handling mechanism introduced by class ActiveXObject. Xbase++ applications need not call this method directly.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.