Re: 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]>
JJ,

> VBA doesn't have any problem with your case of code (tested in
> Excel VBA with ADODB.Stream's array of byte - same problematic
> variant type).

Thanks for checking.

And yes, that (VT_UI1 / Byte() ) is the type of the SafeArray I'm returning.

As mentioned, it has got /some/ support, but VBScript mostly regards it as a 
string.  Which, in my case, it definitily isn't.


And thanks for reminding me of ADODB.  I had downloaded two example scripts, 
but hadn't yet taken a look at them.   Doing a quick(ish) test and looking 
at the "vartype()" result of what "stream.read" returns it does match what 
my method #1 returns: &H2011.  IOW, nothing outof the ordinary (of sorts) 
for VBScript.

After that I checked the TypeLib to that ADOB.stream object and saw that 
neither the "stream.read" nor the "stream.write" methods used a SafeArray as 
its out- or input (none of the methods do), but just used Variants to wrap 
and transport them in.

IOW, althoug I called it "an ugly work-around", it seems to be the way its 
supposed to be done.  Oh well.

Also, the ADODB example mentioned build-in(!) functions like 
lenb(),midb(),ascb() and chrb(), which I was not aware of.  Meaning I do not 
have to write them myself (my "method #2" was an early attempt to them). 
Phew. :-)

And a funny thing : although you can do an "ubound()" on the result of a 
"stream.read", you can't actually access that result as if its an array ...

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.