Jump to content

Retrieving VARIANT FAR* data through ActiveX


Recommended Posts

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.