ActiveX variant to LabVIEW variant

Hi Ppl,
I'm reading ActiveX data from an application(TestStand) in LabVIEW. The data I get is of the type ActiveX Variant. When I use variant to data node I'm able to convert the data to the corresponding data type. Howevere in my application the data type varies dynamically and I cannot use the variant to data node.
I will have to flatten it to string. But the flatten to string node does not work with ActiveX variants. It only works with LabVIEW variant types. So is there any way that i could convert ActiveX variant types to LabVIEW variant. I tried the to variant node too. I too does not convert it as expected.
Thanks,
Sathish
Here is how both the variant types differ
Activex variant (boolean):
'': OLE Variant 
Variant Type -> VT_BOOLValue -> FALSE
LabVIEW variant(boolean):
'Boolean': boolean (TRUE or FALSE) 
FALSE

Hi lordsathish,
Unfortunately, there is no way in LabVIEW to access type data for OLE/ActiveX variant data.  However, you can obtain information about the datatype of a TestStand PropertyObject using the ValueType method:
myObject.Type.ValueType
This will return the data type (see the ValueType help entry for more details).  you can then use the specific type methods (getValBoolean, etc) to extract data.  In the case that you have an array, you can use the ArrayDimensions and ElementType to extract the data from the array.  In the case of a container, the contained items will be considered propertyObjects, so you can use the getNumSubProperties and getPropertyObject methods to access the contained items.
Refer to the PropertyObjectType reference help for details on these methods
I hope this clarifies!
Al B.
Staff Software Engineer - TestStand
CTA/CLD

Similar Messages

  • How do you pass an ActiveX Variant from an external application to LabVIEW?

    Background: I created a LabVIEW ActiveX server. I can access it with my external application (Matlab). I have a control variable in my LabVIEW executable. I want to use Active X to set the value of my control variable from my external application.
    Documentation: The only reference in the documentation for this task is in the Using ActiveX with LabVIEW in the LabVIEW 2009 help. It simply says "Use the variant control and indicator to pass data to or from ActiveX controls." I also went through all the ActiveX examples in the example finder and did not find any vis that passed variables using ActiveX.
    Questions:
    What should my control variable look like in LabVIEW? Should it be a refnum, a variant, or a data type? Does it have to be wired to a vi connector?
    Do I need to do any magic on this variable, such as change its properties?
    How do I pass the value from my external application to the variable in my LabVIEW executable?
    Thank you.

    Hello Lyn,
     The control variable should be a refnum and it would have to be wired to Automation Open with the correct reference.
    Here are some great examples of using ActiveX Server in LabVIEW
    LabVIEW Executable Used as ActiveX Server in LabVIEW
    http://decibel.ni.com/content/docs/DOC-9647
     Calling ActiveX Code from LabVIEW
     http://decibel.ni.com/content/docs/DOC-9073
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • LabView to ActiveX Variant

    Hello,
    I was looking for some help with this. I have had issues in the past with placing arrays into an ActiveX Variant and found that ActiveX variants are not the same as LabView variants. I am tring to place a 0 or a 2 into Property input which is variant type. At this moment, it does not work. My guess is that the activex variant isn't handling the input well. I may be wrong, but my intuition say this is my issue. Does anyone have a way to deal with this? Here is NI's response to the issue. 
    Thank You for your responses.
    -=-=-=-=
    Hi Chuck,
    I was able to talk to R&D and it looks like there is not necessarily a
    simple or new way to handle ActiveX Variant data in LabVIEW. From a previous
    issue I found, the engineer had worked with R&D and said:
    "Use the 'Database Variant to Data' VI instead of the 'Variant to Data' VI
    While the name may be misleading, the Database Variant datatype is the same
    datatype as the ActiveX Variant. The native LabVIEW Variant is different from
    the ActiveX and Database Variant datatypes."
    The customer in that case had a few issues using this VI, though, so it may
    also not help your implementation either; there also is not a "Data to
    Database Variant" function that I am aware of. Furthermore, I understand
    that this VI is the same direction of dataflow as RolfK's example. As far as
    the "Data to ActiveX Variant" implementation, R&D said that it
    would have to be implemented the same way that Rolf has made his VIs. The
    R&D engineers referenced the following example, which is also linked by
    "lvb" in the LAVA forum post:
    NI Community: Dereferencing Pointers from C/C++ DLLs in LabVIEW
    https://decibel.ni.com/content/docs/DOC-9091
    Finally, I did find a post in the LabVIEW idea exchange, which I believe was
    started by "lvb" on the LAVA forum you found. If you are not familiar
    with the Idea Exchange, it is where LabVIEW users can propose and
    "Kudos" (or vote) for ideas that they wish would be implemented in
    LabVIEW. While this does not guarantee that a feature will be in a future
    version of LabVIEW, it does more effectively put it on NI R&D's radar.
    LabVIEW Idea Exchange: Support OLE Variant or ActiveX Variant Type Access
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Support-OLE-Variant-or-ActiveX-Variant-Type-Access/idi...
    Attachments:
    GM FLIR A320 ImageGrab AE.jpg ‏16 KB

    appears it is okay to wire directly like that. I found examples with I16 wired straight to property input. Must be the resister I am writing to isn't work like it should.

  • Slow imc COM (ActiveX)-libraries inside LabView

    Hi
    I'm using the imc COM (ActiveX)-libraries inside labview. The key command is the "automation open" block from LabView and selecting the desired ActiveX class.
    Here his the definition of one of this function:
    Function DChannel.GetDataDouble( StartIndex As Long, Count As Long,
                    Data As Double() ) As Long
    Copies the specified samples in an array of 8Byte real numbers.
    Parameters
    StartIndex
    Index of the 1st sample to copy. The first sample in a channel has an index of 1.
    Count
    Number of samples to copy.
    Data
    Array to receive the values. See remarks section.
    Return Value
    Number of valid samples in <Data>. May be smaller than <count>, when there are not enough samples in the channel (StartIndex + Count -1 > Length).
    The problem and also question is why the parameter Data apears as a variant when I use a invoke node for the above method (should be double()??)
    When using large Data arrays the libraries are very slow in comparison with VB6. I tested the same functions in VB6 and LabView. In VB6 the COM libraries are very fast! Does anybody know how to improve performance with COM Variants?
    Thank you

    I'm not sure you can do anything about the speed as long as you use ActiveX. At least that was the answer I got when I asked a similar question here. It seems that there is a lot of data copying between memory spaces that goes on between ActiveX and LabVIEW and, if there is much data involved, it can take a while. Search these forums for the terms safearray or "safe array" or marshal data and you will find more info on what you are up against.

  • Lost ActiveX connection with LabVIEW server

    I have called LabVIEW in TestStand and tried to execute the test cases .
    While executing I got the following error:  ( Lost ActiveX connection with LabVIEW server.
    The LabVIEW adapter will try to reconnect on the next execution attempt.-18001; An error occurred accessing the LabVIEW ActiveX automation server.).

    Same error.  Is anyone from NI going to bother commenting on this?  It's been >8 months...

  • How to implement an ActiveX server in LabVIEW

    My task is to implement an ActiveX server in LabVIEW 8.0 that will be called from a data management software (DXE).
    The LV server will take care of data acquisition and control.
    I have been looking for tutorials and example code at the NI developer zone and elsewhere without any progress. Information is either to general or code is to old (LV 5.1) to give any help.
    Please, show me to a good example of an ActiveX server in LV 8 properly commented or with attached explanations.
    Alternatively, suggest any tutorial, short course or books with practical instructions.
    Specific information is most welcome.
    I suppose that it is possible to write a ActiveX client in LabVIEW to verify the functions of the ActiveX server ?

    rolfk wrote:
    skalis wrote:
    Thank You. Good to know that I am on the right track.
    However,
    Your sentence "If You look at the several shipping examples..." make me
    little concerned. I am not able to find any example of a LV ActiveX
    server in my LV 8.0 installation. I would be very grateful of You can
    send me any.
    Basically you can not create your own
    Active X server with your own object hierarchy and methods in LabVIEW.
    LabVIEW however can export a predefined Active X server interface that
    is just another access method to its internal VI server interface.
    With this interface you can determine what VIs are available to
    control, load specific VIs from disk if you know their path and,
    execute those VIs and passing parameters to it and receiving outputs.
    So if your software allows you to script the Active X access to an
    Active X server in some ways such as VBA or similar you should be fine.
    If your software expects a specific Active X interface you have to
    implement in the server application, you are out of luck with LabVIEW,
    without using an external component such as an extra Active X server
    DLL that translates between the expected interface and the exported
    LabIVEW interface. But this last method is quite likely not worth the
    hassle.
    Rolf Kalbermatter
    While I did follow the link mentioned above and found the Interop.LabVIEW.dll that is included in the C# project for the purpose of calling VIs from C#, I am frustrated that these methods are 'buried' in a .dll that you have to go and find on the NI web site, and are not ActiveX methods that are available in an ActiveX Object that is installed when you install LV 8.20 PDS. 
    Rolf, I don't know that you will get this email, but are you refering to the methods inside of the Interop.LabVIEW.dll in what you are saying above, and if so, how did you become aware of this .dll? 
    Is anyone aware of any documentation for these ActiveX methods?
    Thanks,
    Wes
    Wes Ramm, Cyth UK
    CLD, CPLI

  • How can i use activeX Control in labview?

    how can i use activeX Control in labview?
    please describe me step by step.
    thanks.

    Well..that was quite helpful..but now I'm encountering certain problems. I've attached the VI I've made.
    I don't need sound at the moment so I dropped it. (Although I tried to play it..but all I could hear was a very annoying sound.) Secondly I don't want to display any date or time..so i dropped that property too.
    Now when I run this Vi...the webcam turns on, the screen of videocapx pops up..then the webcam light goes off..and another pop up appears saying..labview is not responding..and i have to close it reluctantly.
    I haven't placed the stop capture property in this vi. i checked it by placing it too..but that doesn't work.
    I would like to notify that my actual task is to acquire image and then compare it with another one already present on my pc. I want you to please help me out..solve my first query then I'll proceed with the latter part.
    Attachments:
    activexvideocaps.vi ‏20 KB

  • ActiveX to configure LabVIEW and webDAQ

    I'm trying to use ActiveX in LabVEIW to fetch data from a webDAQ/100. I have configured the webDAQ, put I need help to communicate with the webDAQ from LabVEIW (using ActiveX). I've never tried anything like this before, and I would really appreciate some help here

    Margann,
    The best help we can offer is to point you to the ActiveX shipping examples in LabVIEW. This will show you how to use the ActiveX functionality of LabVIEW. If you need help deciding what methods and properties to call on the ActiveX object, then I would contact webDAQ.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Using a Visual Basic ActiveX DLL in LabVIEW

    I' like to use some code written in Visual Basic into LabVIEW. I think the best way to do this is making a dll_activeX. I've seen an example on NI site: http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB992111EE034080020E74861&p_node=DZ52048&p_submitted=N&p_rank=&p_answer=&p_source=External.
    When I use the dll present in the "zipped" file it works (I've registered the dll as described in the article).
    If I compile in a DllActiveX the Visual Basic project (Visual Basic 6.0), present in the zipped file, and I try to use, after the unregistrtion of the old one and the registration of new one, it doesen't work.
    I received the following error:
    error 3005Occurred at automation open: Object specified is
    not creatable in a ActiveX Dll with LabVIEW.vi
    Some ideas?
    Thank you.

    Paolo,
    I am not sure why you are getting the error. I downloaded the zip file re-built the dll and then registered it. I originally had LabVIEW open, so I closed and re-opened it so that it would see the new object. I then pointed the ActiveX refnum to the Project1 class. I still had a few broken wires so I hit ctrl-shift-Run Arrow to force a recompile.
    After all that I ran the VI at it worked great. Once that was done I unregistered it and ran the VI. I got an error as expected. I then re-registered the dll and ran it again. No error.

  • Nivbai activex call to labview missing step result's?

    I'm traying to call NIVBAI script in labview using activex calls to get step measurment information. For some steps 
    I'm geting good valuses, but for some steps in vision builder script wher I'm using calculator or global variable, the values of steps are 0.
    can someone advise me how to correct that problem? attached picture explains my problem. sorry for may englisch.
    Thank's in advance! 
    Attachments:
    problem.PNG ‏39 KB

    Hi antz24,
    Which version of LabVIEW are you using?  This example was developed and verified for Visual c++ 6.0 and LabVIEW 7.1.  If you are using a different version of LabVIEW, it is likely that the ActiveX methods have changed.  Below are the ActiveX methods for LabVIEW 2012:
    http://zone.ni.com/reference/en-XX/help/371361J-01/axprop/vi_class_method/
    Here is some documentation on calling LabVIEW VIs using different programming languages.
    http://www.ni.com/white-paper/5719/en#toc1
    Also, what exactly is it that you are trying to do?  In most cases, your application would probably be best served if it interfaced with your LabVIEW VI as a DLL.
    Andrew T.
    National Instruments

  • LabView 8.5 ActiveX Variant Data

    Hi all,
    First off, I admit I have no idea what I'm doing with this ActiveX stuff however I did find some vi's that do almost what I need.  My question is, how do I know what data I need to squirt into the purple texts under sheets to achieve the result I need.  Specifically, the After which I assume controls whether the new added sheets occur before or after the first sheet created by excel.  I got lucky with the Count but is there another document I need from say Microsoft that tells me what type of data each of these takes?  Sorry for being so ignorant but this is how we learn, no?
    Mark
    Attachments:
    ActiveX.jpg ‏52 KB

    That sounds like you don't have the Visual Basic Help files installed. A "normal" installation of Excel doesn't install this. You have to install them using "advanced customization" of the application. If you're installing Excel as part of office this checkbox is present right below where you select which product(s) to install. Then, in the "Advanced customization" window expand "Office Shared Features". Then make sure that the item "Visual Basic for Applications" and its child entry "VIsual Basic Help" are both selected to be "Run from My Computer".
    As noted, though, this information can also be found on the web from MSDN.

  • ActiveX Variant Pointer - Variant?

    Hello.
    I have an ActiveX control that requires a VARIANT to be passed in. The VARIANT needs to contain a SAFEARRAY of int32s. I have a DLL that assembles the variant SAFEARRAY from a standard LabVIEW array. However, because of limitations on Call Library Function Nodes my DLL function has arguments of long * and VARIANT *. So I end up with a VARIANT pointer rather than a plain VARIANT.
    Q. Why can't Call Library Function Nodes just return a VARIANT?
    Moving along, I wire the VARIANT pointer to a "To Variant" vi and then wire the output to my ActiveX control method.
    => The ActiveX control (IDL SetNamedArray) is meant to share memory with the container application. I assume this is possible by sharing the SAFEARRAY pointed to by p
    array within the VARIANT. The problem is that this doesn't work. The error returned is that "memory is locked" in the vi.
    Q. Does LabVIEW lock SAFEARRAYs?
    If anyone has had any experience manipulating SAFEARRAY VARIANTs in LabVIEW and passing them to ActiveX controls I'd be most interested to hear of any tricks and undocumented features.
    cheers,
    Novak.

    > But I need to do something different because wiring an LV array
    > straight into the method will copy the data into the IDL ActiveX
    > control but the memory is not shared between LV and IDL - I get the
    > memory locking error and the method fails (returns 0). Thats why I
    > tried making the VARIANT myself. I've contacted IDL and when I
    > resolve this issure I will post my findings because it might be of
    > general interest amongst users of ActiveX controls in LV.
    >
    If you want there to be shared memory between the two, then you should
    probably look to make additional methods, one that allocates if
    necessary and copies the LV data into the shared space, and another to
    return the value to the LV diagram from the shared memory.
    Greg McKaskl
    e

  • ActiveX Variant in Invoke Node?

    I'm trying to do some stuff with a Word document through ActiveX in LabVIEW. This is mostly going well, but I am unsure of what the variant options are on the invoke nodes. I have included a picture with the variants on the invoke node circled. Where are these variants documented? What kind of data/type needs to be in the variant to use these options?
    Thanks.

    Whoops... I meant to put this inthe LabVIEW board, not the TestStand board. Will someone please move it to the appropriate board for me?
    Thanks.

  • Using ActiveX variant BTY_string conversion problem

    All,
    I am using LV5.1f1 with a self written activeX libray. I am using a variant
    object type (B-string) to communicate with the library. On the LV side, I
    convert an array of 6 U16/u8 byte to string with the u8 string conversion
    icon.
    It is said, that Lv automatically converts all input objects going to the
    invoke node of the ActiveX object. This is not true, as the string result
    on the library side is wrong in one of the 5 bytes.
    Can anybody help ?? Pleeease

    > I am using LV5.1f1 with a self written activeX libray. I am using a variant
    > object type (B-string) to communicate with the library. On the LV side, I
    > convert an array of 6 U16/u8 byte to string with the u8 string conversion
    > icon.
    >
    > It is said, that Lv automatically converts all input objects going to the
    > invoke node of the ActiveX object. This is not true, as the string result
    > on the library side is wrong in one of the 5 bytes.
    The automatic part refers to the fact that LV maps things like arrays to
    Safe Arrays and LV strings to Variant strings. It cannot however know
    what formatting you expect within a string, and that seems to be your
    problem. When you are converting the LV array to a string, are you using
    a Format to String node where you specify nu
    meric formatting options, or
    are you simply casting them to a binary representation of the string. It
    sounds like you are casting to a binary string. If so, you will probably
    find that the dual byte fields have their bytes swapped since LV always puts
    these binary string representations into big-endian format. You are probably
    better off just wiring the array straight into the ActiveX property or Invoke
    node without any type of casting or converting. If your ActiveX server is
    using strings to pass binary information and expects it to be in little-endian
    order, then you can use the Swap Bytes node that is in the Advanced functions
    I believe.
    Greg McKaskle

  • Problems calling LabVIEW VI through ActiveX inside another LabVIEW VI

    Hi everybody,
    basically I would like to create an ActiveX to be inserted in a LabVIEW VI which at its turn would call another LabVIEW VI.
    I have choosen Visual Basic to create this ActiveX, being the main section code:
    Dim lv As LabVIEW.Application
    Dim vi As LabVIEW.VirtualInstrument
    Dim names(0 To 1) As String, values(0 To 1) As Variant
    'Assign an object reference to VI
    Set lv = New LabVIEW.Application
    'Assign an object reference to VI
    Set vi = lv.GetVIReference(lv.ApplicationDirectory & "\Examples\General\Strings.llb\Parse Arithmetic Expression.vi")
    vi.ShowFPOnCall = False 'Open front panel if requested
    'Initialize the variables & define the strings corresponding to the VI connector labels.
    names(0) = "Arithmetic Expression": values(0) = "1+1"
    names(1) = "Result"
    'Call the VI
    vi.Call names, values
    So, when this ActiveX executes this code sequence it locks when creating the "LabVIEW. Application" object. I have tested this ActiveX from another client application (Internet Explorer) and it works perfectly, so the problem is located in the creation of ActiveX from LabVIEW. Do I need to do anything special in my code or simple it cannot be done what I want to do?
    Thanks !!!
    Jesus Valero
    Plataforma Solar de Almeria.

    Exactly, but really the code of above it's only an example that I want to do. I'm trying something more sophisticated.
    I want to create an ActiveX control that could work as stand alone executation with the ability of directly get some indicator values from its LabVIEW VI container and depending of those values, set the control values of others LABVIEW VIs. I really know that within LabVIEW itself I can get/set those indicators/controls, but with this method I think that the diagram block of the LabVIEW VI container can be more simple.

Maybe you are looking for