Post by b***@gmail.comMy VB6 dll can otherwise handle 64 bit Excel provided it is loaded by a VB6 COM exe.
Doesn't look this VBScript idea is feasible then.
If you host that Script within the 32Bit-environment (your VB6-Dll),
then it is possible to delegate an SQLite-UDF-callback into it.
Below comes an example, which is using the vbRichClient5's built-in
ActiveScripting-Support, to show that such a thing will work:
(this is a VB6-Demo though, which requires a registered
vbRichClient5-package, downloadable from http://vbRichClient.com)
http://vbRichClient.com/Downloads/ScriptUDFs.zip
Here's a ScreenShot of the above Demo-App:
Loading Image...For the Scripters here, who are interested in "what's going on
under the covers"...
The vbRichClient5 is a COM-lib, which has a built-in SQLite-wrapper,
so it's easy to address and use also from VBScript (per passed Objects)
And to delegate SQLite-CallBacks to VBScript-Functions, one needs
to define the Callback-Proc in a *generic* manner elsewhere first
(I did it per VB6 in vbRichClient5).
Generically defined means, that there needs to be a Helper-Object,
which wraps the needed SQLite-APIs for UDF-Handling - and then
this Helper-instance gets passed to VBScript, to implement and
handle the "UDF-matters for the concrete Function in question".
In the above (zipped) Demo, one of the Script-Functions is defined as:
Sub AddSomethingTo(ByVal ParamCount, ByVal UDF)
If ParamCount = 2 Then 'the "normal case"
UDF.SetResultDouble UDF.GetDouble(1) + UDF.GetDouble(2)
'parameter-indices are one-based
Else 'an example, how to raise an error, if something cannot be
handled by your function
UDF.SetResultError "AddSomething: we need two parameters!"
End If
End Sub
In fact, any VBScript-handled SQLite-UDF will have (aside from the name)
always the same Function-Signature with only the shown two Arguments:
- ParamCount (that's how many the User passed into the SQL-Function)
- UDF (here, a vbRichClient5-defined Helper-Class of type cUDF)
Since you are using the RC5 in your solution already, adapting it
to something similar in your own solution should be relatively easy.
HTH
Olaf