ISDBScriptControl::RegisterEvent: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
mNo edit summary
(→‎Method description: Added information about calling from JScript)
Line 10: Line 10:
===Method description===
===Method description===


Registers COM object event to be handled by a script.
Registers COM object event to be handled by a script.
 
JScript note: Method does not accept anonoymous functions or callbacks. A handler function must be defined within global script scope. Then handler function's name should be passed to the method.


===Example code===                     
===Example code===                     

Revision as of 16:47, 15 April 2013

CoClass SDBScriptControl, Interface ISDBScriptControl

Sub RegisterEvent(ObjectVar As Object, EventName As String, HandlerName As String)


Parameters

Name Type Description
ObjectVar Object Object of the event
EventName String Event Name (string)
HandlerName String Procedure name of the handler (string)


Method description

Registers COM object event to be handled by a script.

JScript note: Method does not accept anonoymous functions or callbacks. A handler function must be defined within global script scope. Then handler function's name should be passed to the method.

Example code

Script.RegisterEvent SDB, "OnShutdown", "ShutdownHandler"

Sub ShutdownHandler
  ' Event code goes here....
End Sub