solarisin Posted July 31, 2008 Report Share Posted July 31, 2008 Hello all. Is retrieving the VARIANT FAR* data from a c++ ActiveX method such as the definition below possible in LabVIEW? long GetValues(short , short, VARIANT FAR* ) It seems on the LabVIEW side of things, I receive the array, but its completely junk. Thanks for your input. Quote Link to comment
Rolf Kalbermatter Posted August 2, 2008 Report Share Posted August 2, 2008 QUOTE (solarisin @ Jul 30 2008, 02:44 PM) Hello all. Is retrieving the VARIANT FAR* data from a c++ ActiveX method such as the definition below possible in LabVIEW?long GetValues(short , short, VARIANT FAR* ) It seems on the LabVIEW side of things, I receive the array, but its completely junk. Thanks for your input. You need to give a bit more information here. Where do you see an array here? VARIANT* is a pointer to an OLE VARIANT which could contain an array in about 50 different type and format variants but it could be also a timstamp, numeric of any type either by value or reference, a NULL or quite a few other datatypes. The first word in that VARIANT record contains the code which tells you what the VARIANT really represents in terms of data. And the actual data, certainly in case of arrays or strings is not directly embedded in the variant structure since that structure is fixed size and can only hold directly information for I think 8 databytes. The rest is by reference meaning it is a pointer and after you receive such a VARIANT from somewhere you also need to make sure to release the resources that might be contained inside such a variant such as by using the according VariantClear() API from OLE. As to extracting data from a variant while you could do that by hand what is usually done is to verify that the vt_type is actually what you expect and then use the according OLE APIs (such as SafeArray....() ) to extract that information from the variant. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.