VBScript OCX receive and supply a safeArray of type VT_UI1- problem

"R.Wieser" <[email protected]>
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,comp.os.ms-windows.programmer.win32
Organization A noiseless patient Spider
Message-ID <[email protected]>
Hello all,

I've just build an OCX for usage within vbscript, and am running into a 
problem :

I'm trying to have a method #1 return a SafeArray of type VT_UI1, and later 
provide it to a method #2.

The problem is that when I do this :

Object.Method2(Object.Method1())

everything works.

But when I use an intermediate variable like this

Data = Object.Method1()
Object.Method2(Data)

VBScript throws a "Type mismatch" error - and I have no idea why or how to 
solve it. :-(

Declarations of both methods in the IDL file :

HRESULT Method1([out, retval] SAFEARRAY(unsigned char)* Result);
HRESULT Method2([in] SAFEARRAY(unsigned char) ByteData);

By the way:

wscript.echo vartype(Object.Method1())
Data = Object.Method1()
wscript.echo vartype(Data)

both of the above return &H2011 (array of VT_UI1)

Help ?

Regards,
Rudy Wieser
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.