fayrehouse
13 years agoFrequent Contributor
Does anyone know anything of Callbacks / Delegates in Jscript?
I have an an external DLL that provides a method I need to use that takes 2 params - a string, and an object of class"x" (according to the code completion prompt in TC).        In the documentation an...
- 13 years agoI don't know specifically about JScript, but VBScript for example is not strongly typed. A lot of .Net types simply do not exists in VBScript. So when I have to interface to a .NET library from VBScript, I often have to write a COM-visible wrapper library in .NET first, and call that wrapper library from my script.' Some .NET class function that returns a List(Of String), which is incompatible with standard VBScript 
 Public Function DoSomethingInDotNet() As List(Of String)
 ' ...
 End Function
 ' Intermediate wrapper class function that returns a type compatible with VBScript (in this case an ArrayList)
 Public Function WrapDotNetFunction() As ArrayList
 Return New ArrayList(DoSomethingInDotNet())
 End Function
 ' VBScript code where you call the wrapper, which then calls the actual .NET method.
 Sub Main()
 Set Result = CreateObject("System.Collections.ArrayList")
 Set Result = objWrapper.WrapDotNetFunction
 End Sub