FastFieldSolvers Forum
FastFieldSolvers Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 FastFieldSolvers
 FastHenry2
 VBScript Callback Example

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Antispam question: What do MOONwalk and MOONdance have in common?
Answer:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON

 
   

T O P I C    R E V I E W
brodym Posted - May 16 2018 : 22:56:41
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?

Thanks



Brody Mahoney
1   L A T E S T    R E P L I E S    (Newest First)
Enrico Posted - May 17 2018 : 11:49:34
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")
    Else
        ' 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://alax.info/blog/1381 I have not tested these methods, but this could be a way you may experiment.


Best Regards,
Enrico

FastFieldSolvers Forum © 2020 FastFieldSolvers S.R.L. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06