Passing an ActiveX reference from TestStand to Labview

How can I pass and ActiveX reference (for a dll) created and used in a TestStand sequence (under Locals) to a VI running within that sequence so that I can then call the same instance of the dll from Labview?
(I know this isn't the best approach to programming but I'm more interested in proving the point than anything else)
Cheers
Dan

Here's what I think you are tyring to do. Within your sequence, instantiate an object from an ActiveX DLL, storing a reference to it within a TS variable. Then, within a VI called by this sequence, call a method of the intantiated object.
To do this, when specifying your module on your LV step you must check the Sequence Context ActiveX Pointer check box. In the called VI you must have the a Sequence Context control on your front panel and have it wired to your connector pane along with a TestData cluster control and a LV Error Out cluster control.
Within the VI you use an invoke node to invoke the AsPropertyObject method on the SequenceContext (Make sure you use the ActiveX close function on this new reference when you are done with it.). Use another invoke node to call GetValInterface method on the sequence context property object reference (you could probably also use the GetValIDispatch method. See the help). For this invoke node you will want to use a lookupstring that reference the variable, relative to yo sequence context, in which you stored the refernce to the instantiated object in your sequence file. This will return a variant reference. You must convert this reference to a LV reference using the "To G Data" function in the ActiveX palette. The "To G Data" function requires a type input. You will need an ActiveX Automation Refnum control as the input to this (see ActiveX control palette). You will need to right click on this automation refnum control and browse the ActiveX automation server until you find the DLL ActiveX server from which you instantiated your object within your sequence. Once selected, also select the object that you instantiated. The "To G Data" function will then give you a reference to you object on which you can happily used in your desired manner. Make sure to close this reference with an ActiveX Automation close function when you are done with it.
I would definitely clean this up with a subVI to perhaps generalize the solution.

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

  • Pass object reference from TestStand to C#

    Hi,
    I have created a GUI in .NET which i invoke in TestStand (through a custom step type). User can enter a object reference teststand variable in the UI input expression box. So i need to get the object value in that variable and use it to call some .net functions. To get the values from expression box of UI and put in TestStand step variable i use:
             PropertyObject.SetValInterface("Step.TestStationObj", 0, tsexprTestStationObj.DisplayText.Trim()); To check the value in the step variable if i do:
             MessageBox.Show("TestStation obj after setting:",PropertyObject.GetValInterface("Step.TestStationObj",0).ToString());
    But i do not get any value. Guess it is null. Is this a correct way? My intension is to get the value corresponding to a teststand object reference and pass it to C#. The C# UI control is of type NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit

    Thanks Andy.
    I still get the error when i am trying to pass the object created from C# to Teststand. I have explained what i am trying to do. Kindly requesting your assitance on this issue.
    I have 2 classes in C# (code given below), I am trying to pass the object of "Counter" (c1) class from the "Mainfrm" to teststand. In teststand(counter.seq), I am trying to access the function "GetCount() and SetCount()". I have attached the snapshot of the error that i get from teststand.
    Class Counter
        private int count;
        public int GetCount ()
           return (count);
        public void SetCount(int _count)
           count = _count;
    Class Mainfrm : Form
        public Counter c1;
            private void Mainfrm (object sender, EventArgs e)
                InitializeComponent();
                axApplicationMgr1.Start();
                mEngine = axApplicationMgr1.GetEngine();
                currentFile = axApplicationMgr1.OpenSequenceFile(@"Counter.seq");
                pobj = mEngine.NewPropertyObject(NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Container, false, "", 0);
                pobj.NewSubProperty("Parameters.ObjRef1", NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Reference, false, "", 0);
                pobj.SetValInterface("Parameters.ObjRef1", 0, (object)c1);
                mExecution = mEngine.NewExecution(currentFile, "MainSequence", null, false, 0, pobj, null, null);
    Attachments:
    ErrorFromTestStand.JPG ‏28 KB

  • How can I convert a Database Handle from TestStand to LabVIEW?

    I want to use a Database Handle (already created in TestStand by an Open Database step) in a LabVIEW-VI (called from TestStand) to connect it with the "Connection Reference" input of the "Easy SQL.vi"? If I use a directly connection via the "TestStand - Get Property Value (Number).vi" I get back the error message 4101 in LabVIEW. How can I convert the Database Handle?
    Test Engineering
    digades GmbH
    www.digades.com

    The TestStand database step types use the CVI SQL Toolkit to talk to databases. The handle that you are referencing is an internal memory location and not a actual handle that you can directly use. Currently as implemented the handle that is stored in a numeric TestStand property for the connection and the SQL statement are the handle values returned from the CVI SQL Toolkit. So for the connection handle, you could call the CVI SQL Toolkit function
    DBGetConnectionAttribute (
    int Connection_Handle,
    tDBConnectionAttr Attribute,
    void *Value);
    and get the CVI CAObjHandle reference. With this you could then call the CVI ActiveX function
    CA_GetInterfaceFromObjHandle(
    CAObjHandle Object_Handle,
    const IID *Interface_Id,
    int Force_AddRef,
    void *Inte
    rface_Ptr,
    int *Did_AddRef);
    to get the actual ActiveX interface reference. This would have to be converted into a LabVIEW reference.
    You may want to consider just using LabVIEW to open a new parallel reference only using the toolkit.
    Scott Richardson
    National Instruments

  • If an applicatio​n includes ActiveX references from Excel, should MS Office be installed on the run-time PC?

    There are many threads regarding usage of MS office with LV, but I was not able to find the answer to the following question. I hope somebody can help or point me to a useful thread.
    I have an excel template file and would like to create new reports each time from it. There are a couple of solutions for this problem which are fine. But, at the end, I am going to build an application and install it on an industrial PC which does not have MS office installed. The question is if the application works on the target machine as well.
    I am specifically pointing to the solution in here which uses ActiveX reference to Excel._Application. Any chance that this solution or any similar one works on my target PC?
    If you wonder why I want excel reports on a machine that does not have MS Office, I should say that the reports are just stored somewhere on the disk to be transferred later to headquarters let say!
    Developing machine: Win7, LV8.6 Pro + Report generation toolkit
    Target machine: WinXP SP3, LV run-time engine
    Thanks in advance!
    Soroush
    Solved!
    Go to Solution.

    You need to have Office installed on the computer that is running the LabVIEW application. It is the Office applications that provide ActiveX functionality to the Report Generation Toolkit. Without them, LabVIEW has nothing to interface to.
    http://digital.ni.com/public.nsf/allkb/02E339E2648​4F30186256E920061FBD9
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Obtaining activex reference from activex container

    I have a VI with an embedded MediaPlayer activex object inside an activex container.  Additionally, I have a seperately run VI which I want to be able to control the MediaPlayer obejct in the first VI.  These VIs are opened seperately, so I cannot pass information directly from one to another (i.e., I can't directly pass the MediaPlayer activex reference to the second VI directly).  Therefore, the second VI obtains a reference to the activex container object by searching the first VI's controls and filtering by label.  I can typecast the control reference to the level of activex container, but from there I have no way of obtaining a reference to the object embedded in it.  Is there are way to do this?  The "To more specific class" function does not accept activex references for typecasting, and the automation open does not accept activex container references.  I've searched through the forums, and while there is plenty on activex references and containers, there doesn't seem to be anything that addresses my issue.

    I'm not 100% about whether this will work, but give it a try. Once you have a reference to the container, use the 'Value' property. This will give you a variant. From here you can use Variant to Data, connect a MediaPlayer constant reference to the type input and you should get the correct reference out.
    Also, you could simply get a reference to the VI with the ActiveX control and use the method 'Control Value: Get[Variant]' to get the value of the control instead of getting a list of all the controls and searching for the one you want.

  • User event from TestStand to Labview

    Hello all,
       I have some question regarding Labview-TestStand
       We have a large application written in Labview, user interface separated from the actual
    core using  User Events. Now we consider to automate some repeated actions with slightly
    different parameters. Is the TestStand sutable option for thi case? Can it send the "User event" to
    Labview?
     Thanks
    Michael.
    LV 8.2 at Windows & Linux

    Hi mishklyar,
    tbob makes a good point, and I will try to elaborate a little bit. TestStand is test executive software. It works by executing a set of predefined steps in sequence. These steps can be LabVIEW code, C code, etc. You can pass parameters into the LabVIEW code that you call, but you cannot directly send "user events" the same way that user events are created in LabVIEW by interacting with front panel controls. The traditional design with TestStand is to create a LabVIEW code module that does a particular thing, and have other modules (VIs) that do other things. Then, call each module from TestStand as needed. As the name implies, TestStand is often used for testing products, but could be used for other purposes as well. If your application could be modified to fit this model, then TestStand could probably be used. However, you would probably want to architect your LabVIEW application differently than it is right now.
    Best Regards,
    John M
    National Instruments
    Applications Engineer

  • Pass string by reference from subsequence to caller

    Hi, I am unable to pass a string parameter by reference from a subsequence to its caller. Is there a trick in doing this or is it not possible?
    Thank you,
    Chris
    Solved!
    Go to Solution.

    Right Click on the parameter in the subsequence.
    Make sure Pass By Reference is checked.
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Export Typedefs from TestSTand to LabVIEW

    Hi there,
    is there a possibility to simply export a typedef made in TestStand to LabVIEW? I want to prevent making the same definitions twice.
    Cheers
    Oli
    Programming languages don't create bad code, programmers create bad code....

    Hi Andre,
    that's what I feared importing cluster definitions from LabVIEW into TestStand is out normal way, unfortunately this time we have an exception to the habit 
    Thank you very much. Enjoy the public holiday
    Cheers
    Oli
    Programming languages don't create bad code, programmers create bad code....

  • Passing variables into CVI from TestStand.

    Is there a different way to send variables into CVI from TestStand other than the input buffer? Parsing that string is annoying and bulky. Isn't there an easier way?

    Hi,
    Here is a short cut to another example which will use the StationGlobals -
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=313&HOID=506500000008000000301F0000&UCATEGORY_0=_8_&UCATEGORY_S=0
    There are loads of other examples either as part of the examples provided by TestStand installation or in the Resource Library under TestStand on the NI website
    Good Luck
    Ray Farmer
    Regards
    Ray Farmer

  • Find memory leakage when passing Object Reference from Teststand to vi

    I am using Teststand to call labview vi, and pass ThisContext of sequence to vi as object reference, but if I just loop this step and I can find the memory using keep increasing, how can I avoid the memory leakage inside the vi.
    see my vi, it is to post message to UI.
    Solved!
    Go to Solution.

    You should be using a close reference node to close the references you get as a result of an invoke. In the code below you should be closing the references you get from the following:
    AsPropertyObject
    Thread
    Close those two references once you are done with them.
    Also make sure you turned off result collection in your sequence or you will be using up memory continually for the step results.
    Hope this helps,
    -Doug

  • "Online" massage from TestStand to Labview

    HI boys,
    I want to show a variable in TestStand "Online" in a Labview Front Panel, I mean, if the value this variable changed, I don't need call this VI again, the variable should be updated by itself.
    Of course I can call the VI again to read the new value of the variable, but I think, there must be a smart wey to do it.
    Cabio

    Cabio,
    first of all, not all here are necessarily "boys"...
    Second: VIs only update elements if they are RUNNING (with certain exceptions). So just open a front panel with an indicator and *magically* put in updated values is not the way it will work properly.
    I also epect this question to refer to your "progress display" question.
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?

    How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
    I'm trying to control an ActiveX object (a Web Browser) from another VI and need to get the object reference programmatically. I can get the LabVIEW ActiveXContainer reference, but am lost on how to get the reference for the object _inside_ the container.

    Hi Lee,
    The reference to the container is actually also accessing the object inside the container. Use the Property Node and Invoke Node to access properties and launch methods for the object. I've attached a small example that passes the reference to a SubVI and invokes a method inside the SubVI.
    - Philip Courtois, Thinkbot Solutions
    Attachments:
    WebContainer.zip ‏21 KB

  • Passing telnet session between LabVIEW calls from TestStand

    From TestStand I am calling VI's from telnet.llb.
    In one TestStand step  am opening a telnet session to an IP address and collecting the telnet connection (U32). In the next TestStand step I pass the telnet connection  to a telnet write VI but get this error.
     "Dequeue Element in Acquire Semaphore.vi:1->Telnet Write.vi:1->Telnet Write.vi.ProxyCaller"
    The telnet open, write, read, and close work great if I pass the telnet session number within the same VI. But I need to keep the session open between calls from TestStand because one huge VI is not feasible.
    thank you
    josh
    Solved!
    Go to Solution.

    Hi,
    Maybe the following link can help
    http://forums.ni.com/t5/NI-TestStand/Can-a-Telnet-session-be-passed-from-1-vi-to-the-next-in-test/m-...
    Regards
    Ray Farmer

  • Rapport et Message Pass / Fail de Teststand avec LabVIEW 8.0.

    Bonjour,
    J'ai deux problèmes avec l'OI Teststand avec LabVIEW. J'ai modifié l'exemple présent de l'OI Teststand pour le piloté comme sous VI avec LabVIEW 8.0. Les problèmes étant que je n'arrive pas à afficher le rapport en dynamique pendant que les séquences sont lancées et dans le même les messages popup Pass ou Fail en fin de séquence ne s'affiche pas.
    Merci,
    Résolu !
    Accéder à la solution.

    Voici quelques commentaires et questions car tout n'est pas clair:
    -dans le VI TS OI: LoginOnStart est à False, par contre je ne vois pas d'appel à la front end callback loginlogout (du coup tu n'es pas logé sauf si j'ai raté quelque chose)
    -Il y a des indicateurs (containeurs activeX entre autre) qui semble être invisibles (propriétés?)
    -Le code gagnerait à être plus ordonné (il y a déjà les commentaires sa c'est bien)
    -il y a un start de l'application manager, mais ou est le start de la séquence? normalement c'est un appuye sur un entry point qui le gère (testUUT par exemple)
    -Il y a une méthode open sequence file, mais la reference du sequence file n'est pas utilisée...(c'est après qu'il faut faire une méthode pour lancer la séquence)
    -la méthode Run sur le sequence file view manager sert à quoi?
    -pas mal de fonctions mériteraient un sous VI
    -Les fichiers séquences ne sont pas fournis donc je ne peux pas donner d'indications, par contre dans le VI les chemins pour appeler les séquences sont en dur, donc il y aura des problèmes pour exporter le projet sur une autre station.
    J'espère que sa pourra t'aider, et je reste disponible pour d'autres infos.
    Rodéric L
    Certified LabVIEW Architect

Maybe you are looking for