11-08-2011 05:11 AM
Hi,
In one of my projects, I have to check if a control is a Sequence context control. This cannot be done using any properties like the 'Classname' of the control. Hence I am converting the control reference to variant and using 'Variant to Flattened String' to get the 'type String' array which describes the type. I see that the first two element of this array varies for each control and the remaining elements are the same for controls of the same ActiveX class type. Please tell me if this is the best way of doing it. I have
Thank you.
Ganesh Kumar
Solved! Go to Solution.
11-08-2011 07:54 AM
An easier way to do this would be to use VI scripting to find the name of your typedef and check that. It also has the added benifit of being easier to understand exactly what is being done in the section of code.
Check out the attached VI for an example of performing this type of operation.
All you need to do is to create a reference to your control and use the attached VI to return the name of the typedef file it is attached to. There is more information on VI Scripting in the LabVIEW Help.
Regards,
Dan King
11-08-2011 08:03 AM
There is also a large library of VIs for returning type information from variants in <vi.lib>\Utility\VariantDataType that may help. We do not recommend using type descriptors if you can avoid it.
11-08-2011 08:28 AM
cross-posted on LAVA: http://lavag.org/topic/15179-checking-if-a-control-is-a-sequence-context/
11-08-2011 09:12 AM
DFGray,
Ganesh Kumar is trying to find the ActiveX class of the control. When we convert the ActiveX control to Variant and enable the type to displayed it actually shows the CLSID of the ActiveX server. I don't think any functions in <vi.lib>\Utility\VariantDataType folder give the CLSID information. The CLSID will help to identify the ActiveX server name. Is there any function that will be able to do this ?
11-09-2011 12:29 AM
Dan_K and DFGray,
Thank you for your replies. I am looking for a way to find out whether a control is a sequence context control and that control need not necessarily be a typedef. As Sathish says, we will be able to get the CLSID if we convert the control to a variant. Any method to extract this CLSID from the variant would be useful. I have attached the VI snippet shhowing the conversion to variant.
Thanks,
Ganesh Kumar
11-09-2011 07:46 AM
I believe jcarmody answered this on the LAVA forums. Flatten your ActiveX reference to XML, then parse the XML. The XML includes both the name and the GUID of the ActiveX object.