
Type problem: passing variables to methods
VBScript (or more accurately the default OLE IDispatch implementation) will coerce variants to strongly typed ByVal arguments, but not to strongly typed ByRef arguments. Not all components are "script friendly" and may expect strongly typed ByRef arguments when not strictly needed.
--
Michael Harris
I am using two different controls (iTwain and Kodak/Wang ImagScan) that
use arguments in a method call. ImagScan (and probably iTwain) is
written in C++, and they expect certain variable types as parameters.
Problem: There is no way to type a variable in VBscript. Everything is
variant, and specifying a variant subtype (via csng or formatnumber,
for example) doesn't work. Even if I explicitly list the argument
(rather than using a variable), VBscript must be implicitly converting
the variable to type variant before passing the variables to the
method.
Example
method specification:
controlname.SetTransferFile (String filename, Short filetype)
Code:
Twain1.SetTransferFile("d:\Erik\Scanned_images\twaintest.tif",0)
Error:
Type mismatch
Using variables as arguments doesn't work either.
Any ideas on a workaround would be greatly appreciated.
--
Erik Slotboom
Sent via Deja.com http://www.deja.com/
Before you buy.