COMEvent

(Engine-Level Function)

Description: Sets an event subroutine context for an existing COM client interface.
Returns: Text
Usage: Script Only.
Function Groups: COM
Related to:

ActiveX | COMClient | COMStatus

Format: COMEvent(COMClientInterface [, EventSearchScope, EventParent, EventCaller])
Parameters:  
COMClientInterface
Required. A COM client interface handle returned from a COMClient or ActiveX statement.
EventSearchScope
Optional  May be any expression that yields a Module or an object value. If present, specifies the scope in which to search for event subroutines. No default value is provided.
EventParent
Optional  May be any expression that yields an object value. If present, specifies the context that is used to resolve scope for event subroutines. If absent or Invalid, defaults to Self().
EventCaller
Optional May be any expression that yields an object value. If present, specifies an "auxiliary" context for event subroutines. An event subroutine can retrieve this value using Caller(Self()). If absent or Invalid, defaults to Self().
Comments: The COM client interface specified as the first parameter may or may not already have an event subroutine context associated with it. This function supplies a new context that destructively replaces any existing context. Use of this function enables dynamic modification of the event subroutine context. The context may also be dynamically set if the COMClient or ActiveX function is being run in steady state, by simply changing the parameters of the steady-state statement. It is more usual to use this function for COM client interfaces that are created by a script statement.

EventSearchScope specifies the location where the event subroutines for this COM object instance may be found. When an event subroutine is run in response to an incoming event from the object, the parent and caller for the subroutine are as specified by EventParent and EventCaller.