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,

> It's mainly because for array, VBScript only have native support
> for array of variant.

I know.

What I /exepected/ was that it would just store the returned SafeArray into 
a variant.  It would not be able to do anything with it, but that is where 
Method #2 would come in.

Maybe I asked the wrong question, and it should have been

"How do I get VBScript to store non-native data, like a SafeArray of VT_UI1, 
into a Variant".

> To workaround the problem, store the array of non-variant result
> from `Method1()` into VBScript generated array first,

:-) That is what tried to evade.   The returned data from method #1 could be 
quite large, and having its size multiplied by 16 just because single bytes 
need to be stored in Variants is quite wastefull.

> Only if the method argument type was specifically declared as
> a reference (i.e. only accept a reference),VBScript will pass
> a value as a reference.

While writing this reply I realized that providing a Variant as an [in,out] 
type would probably allow me to put a SafeArray into it, and as such 
bypassingt the auto-conversion.  I'll have to try and see.

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.