That solved the problem and it is working fine with Script BASIC 2.2 code base.
Theming would be sweet!
import com.inc
function Button1_Click(arg)
print "Back in script basic Button1_Click arg=", arg, "\n"
Button1_Click = arg + 1
end function
function Button2_Click(arg)
print "Back in script basic Button2_Click arg=", arg, "\n"
Button2_Click = arg * 2
end function
obj = CreateObject("VB6.Sample")
if obj = 0 then
print "CreateObject failed!\n"
else
print "obj = ", obj, "\n"
oCollection = CallByName(obj, "CallBackHandlers", VbGet)
print "oCollection = ", oCollection, "\n"
CallByName(oCollection, "Add", VbMethod, ADDRESS(Button1_Click()), "frmCallBack.cmdOp1_Click" )
CallByName(oCollection, "Add", VbMethod, ADDRESS(Button2_Click()), "frmCallBack.cmdOp2_Click" )
retVal = CallByName(obj, "LaunchCallBackForm", vbMethod, 21)
print "LaunchCallBackForm returned ", retVal, "\n"
ReleaseObject(obj)
print "test complete!\n"
end if
C:\SB22\sbcom\sbvb3>scriba COM_VB6_Callback_Example.sb
obj = 1414352
oCollection = 1414432
Back in script basic Button1_Click arg=21
Back in script basic Button2_Click arg=22
LaunchCallBackForm returned 44
test complete!
C:\SB22\sbcom\sbvb3>scriba -v
ScriptBasic v2.2
Variation >>Windows32<< build 2
Magic value 859001395
Node size is 16
Extension interface version is 11
Compilation: May 3 2014 21:45:37
Executable: C:\SB22\bin\scriba.exe
C:\SB22\sbcom\sbvb3>