FastFieldSolvers Forum
FastFieldSolvers Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Save Password
 All Forums
 VBScript Callback Example
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  


19 Posts

Posted - May 16 2018 :  22:56:41  Show Profile  Reply with Quote
I am trying to implement the SetEndCallback method in a VBScript instead of polling. There doesn't seem to be any examples of implementing this method. Also in the help documentation, the proto takes on the form:

boolean FastHenry2Object.SetEndCallback(IDispatch* callback, BSTR cbName)

How could I implement this C-style function proto into a VBScript subroutine or function?


Brody Mahoney


410 Posts

Posted - May 17 2018 :  11:49:34  Show Profile  Reply with Quote
You can find an example of implementation of the callback function in the "VisualBasic" sample folder. Actually the implementation is simpler than you expect, as you 'just' need to pass a VB class reference and class function name as callback arguments as below, where "Callback" is my user-defined class (syntax of the prototype is closer to C++ but that's Automation)

Dim callbackObj As New Callback

Private Sub CheckEndCallback_Click()
    ' If checked
    If CheckEndCallback.Value = 1 Then
        ' Set a callback function to be called upon FastCap2 end of simulation
        vResult = FastCap2.SetEndCallback(callbackObj, "FastCapEndCallback")
        ' Set no callback
        vResult = FastCap2.SetEndCallback(Nothing, "FastCapEndCallback")
    End If
End Sub

This is not straigthforward, instead, in case you need to implement it in VBA (VisualBasic for Applications) or VBS (VisualBasic Scripting) as there are limits in what you can do in these VB profiles.

You may have some luck and insight looking at ht*p:// I have not tested these methods, but this could be a way you may experiment.

Best Regards,
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
FastFieldSolvers Forum © 2018 FastFieldSolvers S.R.L. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06