Jason Teagle wrote:
> The problem is that a VARIANT doesn't have many nice ways of converting data
> to the correct format; hence, in this case we have to work with SAFEARRAYS
> which are quite messy when you think how easy MyVariant.pArray =
> my_byte_array would be. In fact, even in VB it's a bit fiddly to send and
> receive byte arrays!

Hmmm, variants do have ways of changing types (the judgement of whether
it's nice or not is left to the reader!): VaiantChangeType(Ex).

Also there are safe array manipulating functions
<http://msdn.microsoft.com/library/en-us/automat/html/28a00e34-3b5e-4a16-9f4c-dd2a72dc8e46.asp>
but using them is a nightmare, to say at least.  You'd be much better
off using COleSafeArray (if I remember the name correctly) which is
available since VC7 IIRC.

Also, there are numerous APIs which can cause less grief when working
with VARIANTs:
<http://msdn.microsoft.com/library/en-us/automat/html/4ecb0c1f-4e4d-4e8b-bd55-9ac6568d027b.asp>.
 These are the APIs used by VB, and by using them you're supposed to get
near-VB comfortable tools to manipulate VARIANTs.


--
Ehsan Akhgari
Farda Technology <http://www.farda-tech.com/>

If you save the world too often, it begins to expect it.

_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to