Using ActiveX controls in GUI application, which uses TestStand API

When using ActiveX controls in TestStand Operator Interface GUI,
CVI reports User Interface Library error no.-143:
"ActiveX control Error" on attempt to load panel, which contains ActiveX controls.
The same code, which takes care of user interface, but not references
TestStand ActiveX API (i.e. not creates TS Engine), works properly.
What's wrong?

Hello again Misha,
Sorry about my previous answer, I overlooked the fact that you were saying this error was caused by placing ActiveX controls in your Operator Interface (OI) GUI (as my example shows I thought the problem was with GUIs displayed from step code modules).
Nevertheless, the problem is still being caused by the same issue, and is solved in a similar fashion. The source for the CVI OI initializes the TestStand engine before it loads/displays the UI panels. The calls to initialize the engine seem to be CoInitializing the main GUI thread as multithreaded apartment (MTA) mode whereas you will need it to be single threaded apartment (STA) mode in order for the ActiveX control container to work properly. The TestStand engine is compatible with either modes, but only one can be in place at a given time. If we CoInitialize the OI's main GUI thread as STA this will solve the problem (the subsequent attempts of setting it to MTA will fail, but again this is ok since the engine is compatible with STA).
In order to perform this functionality you will need to put a call to CoInitializeEx in the main function of the CVI OI source (this will also require that you #include the "windows.h" file at the top of the source also). Here is what the main function in your main.c file for the CVI OI will look like once you have done this:
int main(int argc, char **argv)
int retval = -1;
sArgc = argc;
sArgv = argv;
if(InitCVIRTE(0, argv, 0) == 0) /* Initialize CVI libraries */
goto Done; /* out of memory */
// Intialize main GUI thread as STA to prevent other attempt to make it
// MTA, which will not allow ActiveX controls to be used.
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
/* initialize the test engine */
if(!InitEngine())
goto Done;
if(!InitErrorDialogStrings())
goto Done;
if(!InStandaloneExecutable() && !DisplayRunningInEnvironmentWarning())
goto Done; // get out now
if(!ProcessPreLoginCmdlineArgs())
goto Done;
if(!CfgFile_Load())
goto Done;
if(!CfgFile_RestoreOptionSettings())
goto Done;
if(LoadGUIPanels() < 0)
goto Done;
if(!InitFileQuickList())
goto Done;
/* set initial gui state */
if(!InitGUI())
goto Done;
RunUserInterface();
retval = 0; /* normal exist status */
Done:
/* cleanup */
SeqFileList_DeleteAllSequenceFileRecords();
ExeList_DeleteAllRecords();
IconList_DeleteIconList();
SaveAndCleanupFileQuickList();
CfgFile_SaveOptionSettings();
CfgFile_WriteAndCleanupForExit();
AdaptList_DeleteAdapterList();
DestroyToolMenus();
CloseEngine();
FreeErrorDialogStrings();
return retval;
Note: Remember to #include "windows.h" at the very top of the main.c file and to include ole32.lib in your project file list in order to link in the definition for CoInitializeEx.
Jason F.
Applications Engineer
National Instruments
www.ni.com/ask

Similar Messages

  • How do I use a LabView control element as ActiveX Control in another application?

    I am was trying to include some simple ActiveX Controls(sliders, buttons) in my VBScript. It worked with other ActiveX Components from the web, however I wasn't able to include the LabView ActiveX Controls because I was missing the necessary IDs. Moreover I was able to test the LabView control by inserting it into the VC++- Test Container. But I still can't find the necessary IDs...

    I don't believe that any of the LabVIEW controls (except for 3D Graphs) are ActiveX controls so I'm not sure what control you were able to insert into the VC++ container. What's the exact name of the control? NI does have ActiveX controls that are part of Measurment Studio so maybe it's one of those that you're using?

  • QucikTime ActiveX Control in C# application

    Hi,
    Hope someone can help. I am using the QuickTime Active Control within a C# .NET 2.0 application. I have noticed that after the control has been running for a long period of time ( a number of hours) it crashes, bizarly always at the same point within one of the movies. This movie has been played numberous times prior to the crash, so i know that the file is not corrupted.
    Any help would be much appreciated.
    MB

    0049 wrote:
    Hello everybody,
    I am trying to read and write FileGlobals with TestStand ActiveX control in C#.
    I have tried with:
    SequenceContext contextOfTraceMsg = e.thrd.GetSequenceContext(0, out frameId);
    var filepara = contextOfTraceMsg.FileGlobals.GetSubProperties("ProjectParameter.NestIsTested", 0).GetValue(1); (NestIsTested is a boolean array)
    but with no success.
    Can anyone tell me how to do it right?
    Thank you in advance!
    Regards
    Try this:
    bool nestIsTested = contextOfTraceMsg.FileGlobals.GetValBoolean("ProjectParameter.NestIsTested", 0);
    Hope this helps,
    -Doug

  • Activating locks using TestStand API

    Hello,
    I have a question... how do I lock and unlock a lock, created in TestStand, in Visual Basic (by using the teststand API)?
    Greetz Jan Toebes

    Hello,
    To understand you correctly you are trying to perform a lock or unlock through Visual Basic. For this you have to use the synchronization server, which has a different API for itself. You can get more information about this under "TestStand Supplemental Reference Help" section in the TestStand Help.
    For simplicity sake, lets assume that you have a lock step created in teststand and you want to perform an unlock using Visual Basic.
    To perform this task, you need the SyncManager. This is the main class for all Synchronization objects. This class helps manage the creation and sharing of the different Synchronization objects between threads. You must create all Synchronization objects using this class.
    To get the appropriate instance of the TestStand Synchronization Manager call the Engine.GetSyncManager TestStand API method. The Engine.GetSyncManager method returns the TestStand Synchronization Manager for the appropriate process based on the name of the Synchronization object. So the call would be
    SyncManager = Engine.GetSyncManager(* Name_of_the_lock_Step)
    where the Name_of_the_Step is the actual name of the lock step that we created in TestStand. The "*" before that indicates that this lock step was created in a separate thread and is being shared.
    Now Mutex is the class that implements the Lock synchronization and is used to implement the Lock step type in TestStand. So using the SynCManager will get an instance of this Mutex class by using:
    Mutex = SyncManager.GetMutex(* Mame_of_the_lock_step)
    Now using Mutex you can perform an unlock by using:
    Mutex.EarlyUnlockMutex ( threadId)
    Please refer to the help for more information regarding these functions. I hope this helps.
    SijinK
    National Instruments

  • Using TestStand API Engine to programatically set watch expressions?

    I would like to auto populate the Watch Expression window when I start a sequence. This would allow the test developer to set up a list of variables once and have them available all the time, for troubleshooting. I see references in Test Stand help to insert, remove, clear, etc, but I haven't been able to figure out how to access them. Getwatchexpressions is all I can find, so far. I have looked in TS 3.5 and 4.

    That was the hint that I needed. I am attaching a simple sequence that populates a watch expression. May be useful for others.
    Attachments:
    testwatch.seq ‏20 KB

  • How can I create a custom data type that is a 2D array of string by using TestStand API?

    Hi all,
    I'm new in TestStand:
    I'm able to create a custom data type that is a 1D array of string but I cannot find the way to create a 2D array of string.
    Can anyone help me?
    Thank you in advance.
    Federico

    I made it!!
    Indeed my 2D array is an item of a container:
    /*  Create a new container */
    RunState.Engine.NewPropertyObject(Locals.NewDataType,PropValType_Container,False,"",0)
    /*  Create an array of strings as item of the container */
    Locals.NewDataType.NewSubProperty("Array_2D",PropValType_String,True,"",0)
    /*  Reshape the array as an empty 2D array */
    Locals.NewDataType.GetPropertyObject("Array_2D",0).Type.ArrayDimensions.SetBoundsByStrings("[0][0]","[][]")
    being:
    NewDataType a local property (type Object)
    Attachments:
    AddCustomTypeAndCreateFileGlobals.seq ‏11 KB

  • Is it possible to seperate an ActiveX control from the GUI thread?

    I have an activeX control (*ocx) that we use for communicating with external instruments. We are running into some difficulty because if the communication with the instrument is held up it can take up to 30 seconds to timeout and our LabVIEW user interface is frozen in the mean time. The VI that contains the control itself does not have to be visible and all the subVIs that use the ActiveX reference have been set to run in the "instrument" execution system thread, but the GUI still freezes. Its my theory that since the ActiveX control itself is in a container and part of a front panel, all refernces to it must be executed in the GUI thread. I just wanted to confirm that this was the case. Also if anyb
    ody would like to suggest any work arounds, feel free. The only idea I've had so far was to move all use of the ActiveX control to external code, which is not a very attractive solution for us.

    ....Also if anybody would like to suggest any work arounds,
    > feel free. The only idea I've had so far was to move all use of the
    > ActiveX control to external code, which is not a very attractive
    > solution for us.
    ActiveX controls are loaded into the UI thread and all interactions with
    them, property nodes, and invoke nodes, have to take place in the UI
    thread/main thread of LV. So, setting the VIs to run in the
    instrumentation or other execution systems, doesn't do much good since
    each call to the property or invoke will just have to switch back.
    What other choices do you have? If the control doesn't have a UI
    anyway, it would improve matters if the control were simply an
    automation server. The automation server can be set to run in a single
    thr
    eaded apartment, or a MT apartment. Changing it to MT means that you
    will have to deal with protecting the code from being called from
    different threads, and having those calls interleaving and competing
    with one another. When you change it to be MT, it can tie up other
    threads in LV and leave the UI thread alone. Another alternative is to
    change the ActiveX control to spin up its own thread and have a method
    that initiates, and one that reads the results or returns the status.
    Greg McKaskle

  • ActiveX control is not working with windows NT

    I've have a stand alone application which uses an activeX control.  The application was compiled using Labview 7.1 on a Windows XP machine.  The application will run without any problems on Windows XP and Windows 2000, however the activeX control will not work with Windows NT 4.0.  The activeX control is registered, and I have also compiled the application on a Windows NT 4.0 machine.  I do not receive any error messages, the application will start but will not communicate with the activeX control.  Does anyone have any suggestions?  

    Hello,
    Have you tired running the VI by itself (not exe) on the NT machine? Make sure you are doing adequate error checking in your code. It could be possible that the application is generating an error which in not handled appropriately. Also which service pack do you have installed on the NT machine? Please look at the release notes for LabVIEW 7.1 here.  
    Regards,
    Chetan K
    Application Engineer

  • I like to be able to control an external application (Specifically ICQ)

    I like to control ICQ, a web based massaging application. (Http://www.ICQ.com). My knowledge of ACTIVE X is very limited so if some one can recommend a web page that explains ACTIVE X at a very beginner�s level I will appreciate it. Also if some one could mention what sort of information I need from ICQ to enable me to do that it will be very helpful.

    There are some applications which are designed to be controlled from other programs and systems (Microsoft Office is a good example for me). On the Windows Platform, the method of control is ActiveX.
    The ActiveX functionality must be part of the program design. If an application is not designed and written to allow ActiveX control from external applications, you cannot use ActiveX for controlling this application.
    The lowest common denominator for controlling applications which offer NO interface for external control is simulation of keypresses through the System. Needless to say this is extremely awkward and problematic.
    Bottom line: Not all applications can be "within reason" controlled by an external program. If ICQ does not offer
    an interface for external control, then maybe there is a similar product which has the same functionality as ICQ which DOES have an ACtiveX interface.
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Calling ActiveX Control in Oracle Developer 2000 - Forms 5

    Hi All,
    I am looking for sample code to call an ActiveX control from my application.
    I have a data input form once i submit the data, the ActiveX control is called and the data is transmitted to a 3rd party application. Could you kindly provide me some pointer here please.
    Thanks

    You're using a very old version of forms and also of SQL*Net.
    to be sure that the problem is forms/sql*net related and not due to other reasons (e.g. network), you could install the current version (forms 10g) and just see if the connect is any faster. If it is, you could try to run Forms 5 with a newer version of the oracle-client /Sql*net to see if that works better.
    hope this helps.

  • Intermittent QuickTime ActiveX control crash

    I embeded QT ActiveX control into .Net application. I call "axQTControl.QuickTimeInitialize();" when my form is loaded. Then I point QT ActiveX to a URL:
    axQTControl.URL = "http://location of my movie clip";
    Depending on the network load it either plays the movie or crashes with the following COM exception: "Oops! An error occurred." It is very sensitive to the network conditions: it fails when there are only 2 users hitting the URL. We tested Mac version of our application with 13 simultanious users with no problem. It also never fails if the clip is located on my local drive.
    Is there any workaround? Some settings to try? Please help.

    > Does anyone know how I may obtain developer assistance with this issue?
    Log a case with Adobe Acrobat Developer Support.

  • Passing struct to DLL using TestStand

    I would like to pass structures to the function call in the DLL. Does Test stand supports passing structured.
    I have a function prototype like this
    LONG _stdcall ReadData(HANDLE hInstance, pDataStruct Trans);
    #pragma pack(push, 1)
    typedef struct _DataStruct {
    BYTE Type;
    BYTE DevAddr;
    WORD wMemoryAddr;
    WORD wCount;
    BYTE Data[256];
    } DataStruct , *pDataStruct ;
    #pragma pack(pop)
    I would like to display the Data filed after the function call.
    remaining parameters to the structure are inputs.
    Please point me to any tutorial on TestStand that can help me or Give me a detailed instructions on how to configure it.
    Thanks in advance.
    Lak

    There is a "StructPassing" example in the TestStand/examples folder. It shows how you can pass the struct to DLL function. Additionally, you can access the struct using TestStand API.
    Yevgeny

  • How to call SAP GUI Graphical interface by using SAP ACTIVEX Control?

    Hi,all
    I want to connet my delphi system with SAP system. But we still need to call SAP GUI Graphical interface into our delphi system. Could we use SAP ACTIVEX Control to implement this funciont?
    Or, is there any other method to Call SAP GUI Graphical interface into other system?
    Besides call SAP GUI into IE by using portal
    Thanks and best regards.

    check out this thread
    Re: Calling SAPGUI transaction out of BSP application

  • LabView TEDS library into DLL or ActiveX Control so that I can use it in C or Visual Basic?

    We are developing software in LabWindows/CVI and Microsoft C. I heard that LabView can generate DLLs. Can I turn LabView TEDS library into DLL or ActiveX Control so that I can use it in C or Visual Basic development environment?

    Technically what you are proposing is possible with LabVIEW. With LabVIEW's application builder, VIs can be built into dlls. Also, LV has ActiveX hooks and so you could create a system for calling into it from CVI. However, this is not what I would recommend.
    The LabVIEW VIs have been written to a preliminary version of the IEEE specification (1451.4) that describes the TEDS data which is primarily why I'm advising you against using them. Once the IEEE spec is approved (the current timeline is currently late March), it will become public and you can write your own code according to the specification (or wait for someone else to write it). To help you get started, the spec includes flex and bison code that describes the syntax and structure of the template files
    Internally, we've written some C, C++ and Java code to the preliminary version of the spec and we've found that we can duplicate the functionality of the TEDS Library for LV in roughly 2 weeks in any other language.

  • Unable to print crystal report over web using ActiveX Control

    Post Author: jimmyp
    CA Forum: General
    We have a problem with printing crystal report over web using ActiveX Control.  When clicking print button, it only shows a blank dialog web crystal viewer page without any error.  The page just simply hangs.  We installed the PrintControl DLL and enable all the security setting for ActiveX Control for IE.  It still does not print.  Does anyone know why?  
    Environment.
    Bundle Crystal Report v10
    Asp.net 2.0
    IE 6.0 or higher.
    Appreciate for your help.
    Jimmy

    Post Author: Ian Kulmatycki
    CA Forum: General
    A team member here found this, I haven't read it, I'm not sure if our problems are related to this, but hopefully it helps someone:
    -ian
    When Secure Sockets Layer (SSL) is enabled, using the ActiveX control to print reports from a Crystal 10 DHTML viewer results in the following error message:
    "A communication error occurred, printing will be stopped."
    How can this error message be resolved?
    Resolution
    This is a known issue with Crystal Reports 10 and Crystal Enterprise 10 viewers and has been tracked. The Track ID is ADAPT00282199.
    This error occurs due to the receiving application performing a case-sensitive check for the HTTPS request header value "ON". When a sender application sends the value as "on" in lower case, the error occurs. The update below changes the receiving application to be case-insensitive.
    Hot Fixes or Service Packs address this issue as indicated below. With the updates, this issue is resolved.
    Unless indicated otherwise, Weekly Hot Fix updates from our FTP site have only been tested with English versions of products.
    For Crystal Reports 10 and Crystal Enterprise 10, the update for this issue is included in the Crystal 10 Viewers Weekly Hot Fix (WHF). This is available in English only at the following location:
    ftp://ftp.crystaldecisions.com/outgoing/EHF/viewers10win_en.zip
    This issue is addressed in the following components (and later versions):
    PageObjectModel.dll, version 10.0.5.785, dated 8/25/2004
    ReportRenderer.dll, version 10.0.5.785, dated 8/25/2004
    WebReporting.dll, version 10.0.5.785, dated 8/25/2004

Maybe you are looking for

  • Can't open a dng or raw file in cs5, just stops working. So many problems in cs5!

    I totally feel for you. Just upgraded from cs4 to cs5 and it was the  biggest mistake i ever made. It will probably end my livelihood as a  photographer since EVERY time i open a raw file it crashes photoshop,  makes it freeze up after i have adjuted

  • Can't burn audio cd in vista

    I have run the diag here is what I have: Microsoft Windows Vista Home Edition (Build 6000) Hewlett-Packard Presario C500 (RQ344UA#ABA) iTunes 7.1.1.5 CD Driver 2.0.6.1 CD Driver DLL 2.0.6.2 LowerFilters: PxHelp20 (2.0.0.0), UpperFilters: GEARAspiWDM

  • My apps won't update

    I can no longer use applications such as Craig'slist, groupon, games or other misc. they are grayish on my screen. When I tap to update it appears it is updating but does not. I have went to the apple store and it shows all the same programs need to

  • Transfer camera raw preset to photoshop action

    Hello everyone, do you know if it's possible to transfer the adjustments I did on Camera Raw / LightRoom to a Photoshop action? Thanks

  • Undesired automatic system preferences changes

    Has anybody experienced automatic changes of system preferences after restarting/shutting down the computer? This is what I've been struggling with since I updated to Mavericks on a MacBook Pro 13-inch Mid 2009: 1) Trackpad/scroll direction. I prefer