Calling WPF from TestStand

Hello,
I was wondering if it is possible to develop WPF GUI's that can be called by TestStand.  Ultimately, I would like to create a WPF DLL which can be called by TestStand and fed parameters back and forth.
At the moment I'm trying to just do a very simple WPF form (no parameters, just a message in a window), however, I am having trouble doing this.  I am able to create the DLL in Visual Studio 2010 but when I try to call it in TestStand, it does not seem to work.  I'm also not sure if I am using the correct Action Adapter.  I tried calling it as a .NET adapter but when I do I get the following error:
An exception occurred inside of the call to .NET member 'UserControl1':
System.InvalidOperationException: The calling thread must be STA, because many UI components require this.
   at System.Windows.Input.InputManager..ctor()
   at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
   at System.Windows.Input.KeyboardNavigation..ctor()
   at System.Windows.FrameworkElement.FrameworkServices..ctor()
   at System.Windows.FrameworkElement.EnsureFrameworkServices()
   at System.Windows.FrameworkElement..ctor()
   at System.Windows.Controls.Control..ctor()
   at WpfControlLibrary1.UserControl1..ctor() in c:\users\mcooblal\documents\visual studio 2010\Projects\WpfControlLibrary1\WpfControlLibrary1\UserControl1.xaml.cs:line 22
I can attach files if that helps, just let me know.  In the meantime, I'm going to keep looking for solutions.
Thanks!
Mukesh.

The error says, "The calling thread must be STA, because many UI components require this".
STA is a COM/ActiveX threading model. By default, TestStand threads use MTA rather than STA. Using a sequence call step with its execution option set to "new thread" you can call a sequence using an STA (Single Threaded-Apartment) thread by checking the option for it on the advanced panel of the module settings. You will then likely want a "wait" step immediately after the sequence call to wait for the thread to complete before continuing.
Another alternative is to do the equivalent in your .NET code module (i.e. create a new STA thread internally in your .NET code and have that run your dialog, while the original thread waits for it to complete).
Hope this helps,
-Doug

Similar Messages

  • An error when calling DAQmx from TestStand

    Hi,
    I get very mystic error when calling DAQmx Create Channel (Digital input) and DAQmx Read (Digital Bool 1Line 1Point) vis. Difficulty is that it does not occur every time. It is random. Any ideas what might cause this error? I uninstalled Traditional DAQ drives because they are not in use but it does not help.
    Please, see attachment.
    BR,
    Jick
    Attachments:
    daqerror.PNG ‏80 KB

    Here is some additional information. See attachments.
    I can not get that error using MAX or looping it only. There is something else outside which causes the error. It can not be Traditional DAQ because I uninstalled it. These vis are running in a loop during the test in the batchmodel.
    BR,
    Jick
    Attachments:
    daqerror2.PNG ‏33 KB
    daqerror3.PNG ‏15 KB

  • CVI crashes when calling function from external DLL

    I'm calling a CVI library from Test Stand 4.1.  In that CVI library I load an external DLL (using LoadLibrary) and create a few function pointers (using GetProcAddress).  The DLL loads successfully, and I get addresses for all of the imported functions.  
    However, when I one of the functions is called CVI crashes (Test Stand says it lost the ActiveX connection to CVI) when executing in an external CVI instance.  If executed in the Test Stand process I get a system level exception.
    If I step through the code in CVI, it hangs after trying to step into or over the call to the function pointer from the external DLL.
    I am able to call the functions in a small test project I created in CVI, however when integrating it into an existing test library and calling it through Test Stand it fails.
    Any ideas on how to go about debugging this issue?

    Have you tried calling into the dll that CVI calls directly from TestStand?  I am curious to know if this also crashes.
    I am also curious to know if there are any path references in the dll that is called by the CVI program.  If so are they relative, or absolute paths?
    I ask because one of the possibilities is that relative paths are being used to specify a path from the location of the code that is called, and they are not working because the current working directory is being specified by TestStand, and the paths are not relative to the working directory given by TestStand.
    Jensen
    National Instruments
    Applications Engineer

  • Abort execution of VI from TestSTand

    I am trying to find an easy way to abort or terminate a called VI from TestStand. I am working on a system that controls machines and if something goes wrong I want a stop button that stops the VI immediately and runs a VI thats sends a stop signal to the machine.
    Event seems like it could work and I tried using GetTerminationStatus but I cant get it to trigger an event. I have only tried using ValueChange on both GetTerminationStatus and Sequence Context In.
    Is there a way to get a message popup to pop up and having VI:s running in the background? When the VI:s are done the message closes. If I push the button I want it to set a variable that triggers an event.

    Hi Peter,
    Here's a quick example of how to use the GetTerminationStatus VI.
    Unfortunatlly you can't generate an event in LabVIEW directly you will have to poll the TerminationStatus.
    This will detect someone pressing the Terminate button in the SequenceEditor or TestStand User Interface.
    I've also setup the Terminate Button in the VI to trigger a Termination in TestStand.
    Somethings to keep in mind.
    The difference between Abort and Terminate, is that Terminate will still run the Cleanup Group of any sequences.
    This is very useful to ensure everything shuts down correctly when something goes wrong.
    Hope this helps
    Simon Holman
    Software Engineer
    Certified LabVIEW Developer
    Certified TestStand Developer
    measX GmbH & Co. KG.
    http://www.measx.com
    Attachments:
    Example Abort VI.zip ‏19 KB

  • Can't close CVI panels in DLL-Detach when called from Teststand

    Hello,
    i've got a problem with Teststand calling a DLL produced with CVI.
    1. I use to DLL Attach and Detach calls to load or discard the panels. The attach part works fine, but when the TS sequence ends and i try to unload the module, the "DiscardPanel" function returns a error -129 "operation can only be performed in the thread it was created".
    If i call the same dll from a CVI executable, this doesn't happen.
    2. Additionally, the first time i run the sequence file the panel doesn't correctly quit and return to Teststand, so the whole thing hangs.
    Does anybody have an idea, what is going wrong?
    See attached files:
    ErrorOnDllDetach.seq --> Call DLL from TS
    \bin\usePanelsDll_dbg.exe --> Call DLL
    from CVI
    Attachments:
    NoUnloadOfDll.zip ‏326 KB

    Maik -
    After some more investigation, because of limitations in Microsoft's operating system, developers and CVI are limited in what they can do in DLLMain. Basically load and unload CVI panels in DLLMain just does not work well if the DLL is loaded and unloaded arbitrarily like it is in TestStand.
    One option is to never unload the panels and let CVI and the OS clean up the panels when the process terminates. You can do this by adding an extra reference to your DLL using LoadModule. You would basically prevent TestStand from unloading the DLL, so any dialog would stay around for as long as you like.
    The best way to have the dialog go away when TestStand is no longer using it is to associate your dial
    og lifetime with the execution that is displaying it. You load the panel either when the first call is made into the DLL or by an explicit call to a "Display" function exported from the DLL. Then have the dialog monitor for when the execution is terminated or stopped. This works because TestStand does not attempt to unload the DLL until the execution that is using it completes.
    I have attached an example DLL and sequence that does just this. It uses a default pool thread to display a panel and that thread waits for either an explicit call to a "Discard" function exported from the DLL or or if the execution stops.
    Hope this helps...
    Scott Richardson (NI)
    Scott Richardson
    National Instruments
    Attachments:
    DLLProject.zip ‏344 KB

  • How do I call Vee functions from TestStand ?

    I wish to call Vee functions from TestStand steps.
    I am using Vee 6.01 and TestStand 2.0.

    Hi Gerry,
    Sorry about that. Below is a sequence file created in 2.0.1f1. Please copy the contents of the zip file (previous attachment) into the folder \Examples\VEE\Using ActiveX (VEE 6.0). Please create this directory if it does not exist. The next thing you will need to do, is register the TestStand VEE server located in \Examples\VEE\Using ActiveX (VEE 6.0)\VEE_StepType.dll. To do this:
    1) Select Start>>Run.
    2) Type regsvr32 "C:\TestStand\Examples\VEE\Using ActiveX (VEE 6.0)\VEE_StepType.dll"
    You should get a message saying that the registration was successful. You should now be able to run the example. Please let me know if you encounter any further problems. Thanks!
    Attachments:
    Computer.seq ‏66 KB

  • When I call VI on Linux from Teststand on Windows using TCP/IP I get "file not found error".any sugeestions?

    I am trying to execute a VI running on Linux from Teststand running on windows 2000 prof ,both running on two different machines.I used TCP/IP for the interface using the following steps on Labview VI:tools>options>VIserver>TCP/IP and gave the ip address of both the machines.When I gave the file path as c:\home\test.vi in Edit labview Vi call window(the Vi in linux is stored in /home/test.vi)and also in remote vi path:/home/test.vi,I get a file not found error.The teststand version is 3.0 and labview is 7.0.Any idea why this is happening and any solutions?

    priya guru,
    Here is a knowledge base that addresses your question: �How do I call test VIs that reside on a non-Windows platform from TestStand?�
    You also need to set TCP/IP Access found in Tools->Options->'VI Server: TCP/IP Access'. Make sure that you list the IP address in the Access List to allow TCP/IP access to that machine. Finally you need to specify which VIs are accessible to remote applications. Open up Tools->Options->'VI Server: Exported VIs' and provide paths to the VIs you wish to be remotely accessible.
    I have attached an example VI that demonstrates VI Server in action. Please post back if you are still having problems. Good luck!
    Cr
    aig H.
    National Instruments
    Attachments:
    Remote_Run_--_VI_Server.zip ‏88 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

  • Calling DLL2 from DLL1 from TestStand

    Hi,
    I have a TestStand sequence that calls function1 provided by DLL1.dll,
    which in turn calls function2 in DLL2.dll.
    If my test sequence consists of a single action, 'Call function1 from
    DLL1.dll', the sequence fails with the error message 'Could not load
    DLL or external library DLL1.dll'
    If I insert a new action BEFORE this action, 'Call function2 from
    DLL2.dll', both DLLs load with no problem, and the sequence operates as
    expected, except that I have an additional unwanted call to function2.
    (This extra call loads DLL2.dll, so it is already in memory when
    DLL1.dll is loaded, so the second load is successful)
    I have managed to reproduce this problem with the following
    configurations:
    1. DLL1.dll and DLL2.dll are regu
    lar DLLs using MFC created with MSVC++
    6.0.
    2. DLL1.dll is a regular DLL using MFC created with MSVC++ 6.0, and
    DLL2.dll is created with LabWindows/CVI 5.0.
    Any ideas / suggestions as to how I can remove the initial call to
    function2 are much appreciated.
    Cheers,
    Jerry
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

    Thanks Paul, that's done the trick...
    Cheers,
    Jeremy
    In article <[email protected]>,
    [email protected] wrote:
    > Jerry,
    >
    > When DLL1 attempts to call DLL2, it can't find it in the DLL search
    > path. Either put DLL2 in the same directory as DLL1 or put DLL2 in
    the
    > Windows\System or Window\System32 (WinNT) directory. If DLL2 uses
    > a .UIR file, copy this also. If DLL2 calls other DLLs, they should be
    > in the DLL search path also.
    > TestStand loads DLL2 directly so it doesn't need to be in the search
    > path for TestStand to find it.
    >
    > Let us know if this solves\doesn't solve the problem.
    > Paul Mueller
    > National Instruments
    >
    > In article <[email protected]>,
    > [email protected] wrote:
    > > Hi,
    > >
    > > I have a TestStand sequence that calls function1 provided by
    DLL1.dll,
    > > which in turn calls function2 in DLL2.dll.
    > >
    > > If my test sequence consists of a single action, 'Call function1
    from
    > > DLL1.dll', the sequence fails with the error message 'Could not load
    > > DLL or external library DLL1.dll'
    > >
    > > If I insert a new action BEFORE this action, 'Call function2 from
    > > DLL2.dll', both DLLs load with no problem, and the sequence operates
    > as
    > > expected, except that I have an additional unwanted call to
    function2.
    > >
    > > (This extra call loads DLL2.dll, so it is already in memory when
    > > DLL1.dll is loaded, so the second load is successful)
    > >
    > > I have managed to reproduce this problem with the following
    > > configurations:
    > >
    > > 1. DLL1.dll and DLL2.dll are regular DLLs using MFC created with
    > MSVC++
    > > 6.0.
    > >
    > > 2. DLL1.dll is a regular DLL using MFC created with MSVC++ 6.0, and
    > > DLL2.dll is created with LabWindows/CVI 5.0.
    > >
    > > Any ideas / suggestions as to how I can remove the initial call to
    > > function2 are much appreciated.
    > >
    > > Cheers,
    > >
    > > Jerry
    > >
    > > Sent via Deja.com http://www.deja.com/
    > > Share what you know. Learn what you don't.
    > >
    >
    > Sent via Deja.com http://www.deja.com/
    > Share what you know. Learn what you don't.
    >
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

  • Calling labview executable from teststand

    I have a labview VI that I build into an exe, and I'd like to call it from my teststand sequence in the setup - other test steps need to use its capabilities in the remainder of the sequence (main).  If it were just a VI, then no problem, the inputs would be visible to me, and I could pass them in.  Since it's an executable, though, my step is of type "Call Executable", but I don't see anywhere that it allows me to pass in the inputs it needs.  Thoughts?
    Solved!
    Go to Solution.

    What version of TestStand are you using?  With TestStand 4.0 for the 'Call Executable' step there is a line called
    Argument Expression:
    Enter your parameters to pass into your LabVIEW executable.  You will have to know which ones to pass in and in what order. I believe you can seperate the arguments by spaces.  In my attachment, I pass in one parameter to a LabVIEW executable.
    Remember, though you have to set the Build properties in LabVIEW to allow it to Pass command parameters to the application.
    Thanks,
    PH
    Attachments:
    Call Executable.JPG ‏48 KB

  • I want to call the DMM- SFP from Teststand using IVI

    Hi I have a Teststand 3.0 system with a NI-PXI 4070, and I want to call the DMM-SFP from Teststand using the IVI driver architecture. Unfortunatley I cannot figure out how to link the DMM-SFP to the Logical name.

    ADL,
    If you are using the TestStand IVI step types, after you have added the logical name in MAX, you can insert an IVI DMM step type. Then right-click on the step and choose "Edit IVI Dmm". You should be able to choose from the Logical Name Ring Control the logical name you created in MAX.
    If you haven't added the logical name into MAX, depending on what version of MAX you have, you can refer to Using Measurement & Automation Explorer 2.x to Configure Your IVI System or look in the IVI help that comes built into MAX 3.0.
    If you checked there already or have another question, please let us know!
    Regards,
    Shannon R.
    Applications Engineer
    Nati
    onal Instruments

  • Problem calling a LabVIEW VI from TestStand

    I'm am currently migrating my companies test scripts from TestStand 3.0 to TestStand 4.1.1 and VI's from LabVIEW 7.0 to LabVIEW 8.6.  I have re-saved all of the sequence files to the new version as well as performed the 'Mass Compile' operation on all of our custom VI's.  During the execution of one of the sequence files a call is made to a VI (through a LabVIEW library).  If I run this sequence file on a machine with the development software and have the Adapter for LabVIEW set to use the development system the VI executes as expected.  If I have the adapter set to use the Run-time engine (in this case 8.6, the same as the development version) I get an error:
    "LabVIEW:  The VI is not executable. Most likely the VI is broken or one of its subVIs cannot be located.  Open the VI in LabVIEW using File>>Open and verify that it is runnable."
    I noticed that in the library file there are sub VI's that are called from  "C:\Program Files\National Instruments\LabVIEW 7.0\vi.lib"   This directory only exists on machines that have the development system installed.  Perhaps this is why the VI does not execute using the runtime engine

    Ray is right. Development environments are backwards compatible (you can run VIs compiled in LabVIEW 7.1 or 8.5 in LabVIEW 8.6). That's why you can run your sequence just fine on the development system, but on the target machines you are using the LabVIEW Run-Time engine, which is not backwards compatible. With the Run-Time engine, ALL VIs need to be in the same version as the Run-Time engine (including VIs in vi.lib, tools.lib, instr.lib, etc.).
    The first thing I would check is make sure everything has been mass compiled to 8.6, including vi.lib. If you are still getting the error you should be able to tell at what point the error occurs so you can look at that specific VI. Open it and confirm there isn't a broken run arrow and check to see what subVIs that VI is using and confirm they all have been compiled in version 8.6 too.
    This should get you going, but if not just let us know.
    Message Edited by CorbinH on 05-07-2009 08:24 AM

  • HTBasic hanging while doing a GPIB command, Called from TestStand

    I have functions in HTBasic called from TestStand for doing GPIB communications for different test sets. When i run the main sequence, the sequence hangs in a HTBasic step. The step is different every time. Does anybody know about this problem?

    Hi,
    I have some questions.
    Does the HTBasic programs run by themselves?. Or does it only hang when executed in TestStand?.
    What GPIB driver and interface are you using?. What GPIB operations are you performing?. Is there any error message shown?.
    The main idea is to figure out if the error is caused by the GPIB operation or by TestStand.
    Include any information you may consider important.
    DiegoF
    National Instruments.

  • Call Vision Builder 2014 AI from TestStand 2014.

    I need info on how to run Vision Builder 2014 AI from TestStand 2014

    Hello jspeedz,
               I did have a look at that doc it didn't address in enough details to my needs. I figured out the process thanks.

  • 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

Maybe you are looking for