RunUserInterface in c#

I know this might be a matter of odd ball but I'm curious to see if there is a way to do it.

I have a small library of tools compiled into a DLL loaded as 'plugins' in several other of my applications.  These dll load their own panels, were reminders of the event etc. They all work wonderfully when loaded into a CVI application that has a RunUserInterface() or other event CVI processing loop.

Now the question arises.  I have a c# application in which I would use one of the plugin dll.  I can call c# DLL functions and panels are loaded and the CVIRTE is loaded, but how do I / can I process the events to the responsible panels of the plugin? or start a RunUserInterface thread that will get the event messages and call reminders of Panel?

Greg

I found my error thanks.  I can lay a thread from c# to Init my DLL and then make a call to RunUserInterface and all is well.

Greg

Tags: NI Software

Similar Questions

  • RunUserInterface cause GPF on the 2nd round

    CVI 7.1.1

    DLL of CVI called by TestStand 3.1.1

    By pressing the sequence 2nd time, RunUserInterface cause general protection fault.

    Manually unload all modules in TestStand does not help.

    However, manually, stop tscvirun in CVI after the 1st round, work.

    DiscardPanel is called in the 1st round.

    How to find resources is now in memory?

    TIA.

    Problem solved.  There are dynamically created tabs (using EasyTab_ConvertFromCanvas) on the Panel, unaware how close to Panel.

  • CVI executable causes an on update of Windows 10 anniversary 0xC0000005 Access Violation.

    Created executables always causes an Access Violation (0xc0000005 exception) to the closing period on Windows 10 RS1 (update of the anniversary).

    This problem occurs in LabWindows CVI 2015 and 2015 SP1.

    How to reproduce: simple program to create and compile with the (x 86) release profile by default.

    for example:

    #include "test.h".

    int ph;

    int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine, int nCmdShow)
    {
    If (InitCVIRTE (hInstance, 0, 0) == 0)
    Returns - 1; / * memory * /.

    pH = LoadPanel (0, "test.uir", group of EXPERTS);
    DisplayPanel (ph);
    RunUserInterface();

    return 0;
    }

    int CVICALLBACK CallExit (int, int int event, control panel,
    void * callbackData, int eventData1, int eventData2)
    {
    switch (event)
    {
    case EVENT_COMMIT:
    QuitUserInterface (0);
    break;
    }
    return 0;
    }

    The problem is visible on the control panel > reliability history > Error Reporting:

    Also the code of the executable file (exit code) is always 0xc0000005 instead of zero.

    To check out more easily code can be called the executable through file .bat:

    off @echo
    Test.exe
    echo ExitCode = %ERRORLEVEL%
    pause

    I have observed that if multiple instances of the same program are running, only block when the last instance is closed. It seems that the problem occurs at the time that the CVI runtime is released from the ram. (The latter is only a guess)

    Hello

    We did some research and saw that the failure is related to some police files in

    c:\Windows\SysWOW64\cvirte\fonts

    c:\Windows\System32\cvirte\fonts

    Could you try deleting these files and see if the heater is always performed. If this isn't the case, it would be a work around if you do not use these fonts.

    We continue the investigation to see the exact cause

  • Problems with a console application

    Hello

    I developed an application in LabWindows. Now, I want to link it with the console. I don't know how I can call my *.exe data and files, the program needs. When I run the program there is a problem. I generate a signal for example 10 seconds, but in reality, I generate only 550 MS so the conclusion is, that the program ends before should really finish.

    I have no idea whence this behavior. I tried to turn the when to stop, but the program has not competed in any of my breakpoints.

    So I think that I have a failure in the main menu. Subsequently, you can see the test how I tried to run. (Here, I can switch my program)

    int main (int argc, char * argv [])
    {
    // **********************************************************************************
    Calls the interface
    // **********************************************************************************

    If (InitCVIRTE (0, argv, 0) == 0)
    Returns - 1;    / * memory * /.
    If ((PanelHandle = LoadPanel (0, "AWG.uir", MainPanel)))<>
    Returns - 1;
    argc = 2;

    argv [1] = "test.uir";
    if(argc == 1)
    {
    DisplayPanel (PanelHandle);
    RunUserInterface ();
    DiscardPanel (PanelHandle);
    return 0;
    }
    else if (argc > 1)
    {
    Load the file, the program must

    If (RecallPanelState (PanelHandle, argv [1], 0))< >
    MessagePopup ("error", "File could not be loaded!");

    Gets a value that is important for the program
    GetCtrlVal (PanelHandle, MainPanel_TREE, & g_Mode);

    Starts the program
    ChooseMode (MainPanelHandle);
    }
    }

    My Messenger runs into the ChooseMode and the program starts. It extends to all the funktion and I see the small part of the signal that I described above.

    Made a mistake when I wrote this part or is there a lack of part for my correct program execution?

    Best regards

    If you have a user interface, why not to call ProcessSystemEvents ()?

    I imagine that you view settings in the user interface, and other items on the delivery of the program, as well as value of the State on what he does and bmaybe a progress bar or a similar method to inform the user of the program activity. At the end of the program, a function may call QuitUserInterface to close the program.

  • Update problem UI while ICB running callback functions

    Hello

    I have a simple code CVI that aims to blink a LED on the Panel for some time when the user double clicks on a button in the Panel (right). The CVI code is as below.

    #include
    #include
    #include
    #include
    #include «run Fn.h reminder»
    #include

    public static int panelHandle;
    int i = 0;

    int main (int argc, char * argv [])
    {
    If (InitCVIRTE (0, argv, 0) == 0)
    Returns - 1; / * memory * /.
    If ((panelHandle = LoadPanel (0, "Run rappel Fn.uir", PANNEAU)))<>
    Returns - 1;
    DisplayPanel (panelHandle);
    RunUserInterface ();
    DiscardPanel (panelHandle);
    }

    int CVICALLBACK (int, int int event control panel Run,
    void * callbackData, int eventData1, int eventData2)
    {int i = 0;
    switch (event)
    {
    case EVENT_RIGHT_DOUBLE_CLICK:
    printf ("detected event");
    SetCtrlVal (panelHandle, PANEL_NUMERIC, 23.78);
    SetCtrlVal(panelHandle,PANEL_LED,1);
    for (i = 0; i<>
    {
    SetCtrlVal(panelHandle,PANEL_LED,0);
    Delay (1);
    SetCtrlVal(panelHandle,PANEL_LED,1);
    }
    break;
    }
    return 0;
    }

    But is does not work as expected. The State of the led façade is updated that once the switch housing ends its execution. He did update in the for the loop runs. As a beginner, I have no much idea about the programming of the CVI. However, I found the following information.

    http://zone.NI.com/reference/en-XX/help/370051V-01/CVI/uiref/cviprocessing_events/

    http://zone.NI.com/reference/en-XX/help/370051V-01/CVI/uiref/cviprocessdrawevents/

    But I don't know how to use them.

    Any help is appreciated.

    Best regards

    Dembélé Jacob

    Actually you need not order you found since SetCtrlVal already have an update of the user interface: simply give the State ONE time for the user to see.

    for (i = 0; i<=100;i++)>
    SetCtrlVal (panelHandle, PANEL_LED, 0);
    Delay (0.5);
    SetCtrlVal (panelHandle, PANEL_LED, 1);
    Delay (0.5);
    }

    A vision a bit in these commands, you found:

    ProcessDrawEvents () will force an update of the user interface, but like I told you this is already implicit in SetCtrlVal, at least for the addressed control. You need to use this command if other tasks in the application would update the values displayed on the screen.

    ProcessSystemEvents () allows the program to honor even user interface events inside a tight like yours: at the present time, there is no way to stop the process until the for loop ends because even if the user has pressed a button to shut down the system would not see this event inside the loop: ProcessSystemEvents () would allow it.

  • Display of Acquisition sample done with a USB-4431

    Tried a bunch of examples, code the DAQ Assistant, mega-search time. At the end of the road. It's about my first traditional appointment to programming DAQmx after years of programming DAQ followed a long hiatus.

    I use a hammer strength IEPE hit to begin sampling of a USB-4431. I'll be post-processing fft; I want ten seconds of data to 4096 samples per second (40960 samples).

    As I am acquiring data, I want to update a chart to display the contents of the buffer, adding data to the chart every 125 mS up to what the end of the second 10 captures.  Relaxation, start sampling data and acquisition works very well. The problem becomes it to the chart control.

    The graph is updated in spurts and incompatible adjustments. The second set of 10 shot finally makes the curve, but it takes anywhere from 30 to 120 seconds to display, sometimes in quick "pieces" with long breaks. Sometimes the initial trigger data gets poster immediately, and it takes sometimes 15 seconds just to display the first 512 samples!

    I obviously had something fundamentally wrong here.  Could someone please have a look at the code below to me. TIA ~!

    void main (void)
    {
    X_AxisIndex = 0;
    NumDataPoints = 512; A sample rate of 4096 samples/second, trying to update the chart each 125 milliseconds.

    CreateDaqTask();
    DAQmxStartTask (taskHandle);
    RunUserInterface();

    } / / Hand

    Sub CreateDaqTask (void)
    {
    It all works very well as far as I KNOW *.
    DAQmxCreateTask("",&taskHandle);
    DAQmxCreateAIForceIEPEChan (taskHandle, ' Dev1/ai0', 'Hammer', DAQmx_Val_PseudoDiff,-10, 100, DAQmx_Val_Pounds, 50.0, DAQmx_Val_mVoltsPerPound, DAQmx_Val_Internal, 0,0021, NULL);
    DAQmxSetChanAttribute (taskHandle, 'Hammer', DAQmx_AI_Coupling, DAQmx_Val_AC);
    DAQmxCfgSampClkTiming (taskHandle, "OnboardClock", 4096, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 40960); Take 10 seconds of a data value to 4096 samples per second.
    DAQmxCfgAnlgEdgeStartTrig (taskHandle, 'Hammer', DAQmx_Val_RisingSlope, TriggerLevel);
    It all works very well as far as I KNOW *.

    The idea here is to launch a reminder all the 512 samples/4096 samples per second = 125 mS so I can view the data in a chart control, update all the 1/8th of a second.
    DAQmxRegisterEveryNSamplesEvent (taskHandle, DAQmx_Val_Acquired_Into_Buffer, NumDataPoints, 0, EveryNCallback, NULL);

    } / / CreateDaqTask

    Int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
    {
    Read the data of 512 points and display them.
    DAQmxReadAnalogF64 (taskHandle, NumDataPoints, 15.0, DAQmx_Val_GroupByChannel, buffer, NumDataPoints, & CurrentBufferIndex, NULL);
    PlotWaveform (main, Main_Graph, buffer, NumDataPoints, VAL_DOUBLE, 1.0, 0.0, X_AxisIndex, 1.0, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_YELLOW);

    X_AxisIndex += NumDataPoints;

    return 0;
    } / / EveryNCallback

    Thank you, WW, I'll give that a try.

    > For input analog, the USB-4431 has a size of 1 023 sample buffer, and it is shared by all channels. .

    Can you tell me where you found this information please? I looked and looked, obviously in the wrong place.

    Also, I discovered that if I move the mouse quickly as he tries to redraw the graph, it draws a lot more systematically and quickly, but still not in real time.

    UPDATE: I got SetSleepPolicy (VAL_SLEEP_NONE); active.

    I thought it was to prevent Windows events interfere with the events of data acquisition. Seems to have the opposite effect here. I turned it off, works great now.

  • Custom context menu settings passage

    Hello.

    I created a group of experts and to he view as popup modal dialog box.

    My code is:

    int panelHandle = LoadPanel (0, "Dialog.uir", group of EXPERTS);
    <>
    return 0;
    DisplayPanel (panelHandle);
    RunUserInterface();
    DiscardPanel (panelHandle);

    I need to pass several parameters in the dialog box. How can I do?

    Thank you.

    A series of SetCtrlVal do you want?

  • TestStand two UI

    I load a UI in SequenceFileLoad and close in SequenceFileUnload.but I run the movie file and notes that the teststand is always running in SequenceFileLoad, from endpoint it.how can I realize this feature?

    Thank you

    These functions do not create a new thread, they just create a window in the current thread, but does not process messages (i.e. does not RunUserInterface()) for this. TestStand execution threads to process window messages when they are inactive, but don't count on that for a thread of execution TestStand could be reused by another execution at any time and that another execution would not process window messages in this thread. It is better to create your own thread for your UI you will have full control over.

    Or maybe write a custom UI or change one of those we ship might be a better alternative for you. TestStand comes with an interface user written in ICB with source code that you can modify. Allowing your user interface panels to run in the UI thread main of the application rather than having to create a thread separate.

    Hope this helps,

    -Doug

  • Initialization problem

    Hello

    This is my code:

    int main (int argc, char * argv [])
    {
    error int = 0;

    / * initialize and load resources * /.
    nullChk (InitCVIRTE (0, argv, 0));
    errChk (panelHandle = LoadPanel (0, "CVI GUI.uir", Panel));

    / * display of the control panel and run the user interface * /.
    errChk (DisplayPanel (panelHandle));
    errChk (RunUserInterface ());

    initialize everything
    if(cycle == 0) initialize (Panel);
    else ResetTextBox (Panel, tabPanel1_tbxSystemMessage_A, "not initialized");

    Error:
    / * Cleanup * /.
    If (panelHandle > 0)
    DiscardPanel (panelHandle);
    return 0;
    }

    Sub Initialize (int Panel)
    {

    srand (time (NULL));

    now activate timer
    SetCtrlAttribute (Panel, tabPanel1_tmrTIMER, ATTR_ENABLED, TRUE);

    } //END Initialize()

    I met 2 problems that I can't fix right now.  I use global variable 'cycle' as my number of cycles, with the initial value of 0.  'cycle' is incremented by 1 each time that ticks of the timer.  In the Main() code, when it is zero, I call my function Initialize().  However:

    1. the Inifitialize() function is never called.  The timer is never activated.

    2. the object referencing a problem.  This line:

    ResetTextBox (Panel, tabPanel1_tbxSystemMessage_A, "not initialized");

    has a problem with 'Panel' (a global object).  I try again with 'panelHandle', and always he fouls out.  Same thing with this line:

    SetCtrlAttribute (Panel, tabPanel1_tmrTIMER, ATTR_ENABLED, TRUE);

    The "jury" passed is incorrect if the timer is never activated, but I don't know what is right for him.  Anyone has an idea on how to fix it?

    I think I found the root of the problem.  These two lines:

    errChk (DisplayPanel (panelHandle));
    errChk (RunUserInterface ());

    bring up the user interface and the thread goes in.  Anything done on the user interface written after these two lines are not executed until the thread leaves the user interface.  The Timer object exists only in the UI thread.  Thus, anything done to the "jury" and the timer object must be within the UI thread.  I changed my code to get concrete results.  in any case, thank you so much Wolfgang.

  • Strange behavior of the LoadLocalizedPanel Panel

    Hi all:

    When I use LoadLocalizedPanel to make my program with multilingual:

    void CVICALLBACK menu_English_Select_Click (menubar, menuItem int int, void * callbackData, Panel int)
    {
    char buf [256] = "";
    char bufABOUT [256] = "";

    char tmp [128] = "";
    kal_uint8 strPath [MAX_PATHNAME_LEN];
    kal_uint32 i;

    char [MAX_PATHNAME_LEN] langFilePath;
    int appLanguage;
    int panelLLP, dialog, error = UIENoError;

    <>
    Returns - 1;

    appLanguage = ENGLISH;

    GetLocalLanguageFilePath (appLanguage, langFilePath);

    <>
    {
    If (error is UIEFileWasNotFound)
    {
    char errBuf [ERR_MSG_LEN];

    sprintf (errBuf, ' error loading Panel. ") Cannot find the \nlanguage file \"%s\". " (', langFilePath);
    MessagePopup ('error', errBuf);
    }
    Returns - 1;
    }

    DisplayPanel (panelLLP); If I DisplayPanel this Panel, it will be out of the control of main didn't work

    RunUserInterface ();

    DiscardPanel (panelLLP);
    }

    If I "DisplayPanel" this Panel, it may change the language of my program, but it will all main control did not work. For example, if I click on the button (belong to main) to select the file to open, the chain control cannot have that wire path and if I click on the button (belong to main) to do something, he does the effect too.

    If I annotate it(//DisplayPanel (panelLLP) it only changes the language of the menu bar and no tongue. the main but all main control works properly.)

    Why is - this problem appear?

    Behavior of strage DefaultPanel/DefaultCtrl on panel located
    http://forums.NI.com/T5/LabWindows-CVI/strage-behaviour-of-DefaultPanel-DefaultCtrl-on-localized-pan...

    It is a reminder for a control on an existing group, right?

    In which case, you should not call RunUserInterface once: the problem you are experiencing may derive from this.

    In addition, if you want to locate the active panel, you can simply use LocalizePanel by passing the handle to the existing Panel, without the need to load again: the original panel and the newly loaded otherwise is cohexist in memory and on the screen until you explicitly throw one of them.

  • How to get a signal triggered by TIMER (under Board user) using GetUserEvent() event

    Hello

    I want to use GetUserEvent() inside a loop for the TIMER event, rather than use the calllback RunUserInterface() and TIMER to vote.

    but it seems that GetUserEvent() can not get the TIMER event. Is there something I should note before using GetUserEvent()?

    I use a button (PANEL_Add) switch TIMER ON / OFF, the time interval is 1 second and TIMER is initially DISABLED.

    PANEL_LED indicates the State of the TIMER POWER indicator.

    PANEL_LED did turn after I click on the command button, but the value of the counter has not changed anyway when the TIMER is activated.

    Thank you for answering ~.

    Here is my code

    ==================================================================

    int main (int argc, char * argv [])
    {
    error int = 0;
    int done = FALSE;
    int eventPanel;
    int eventCtrl;
    int panelHandle;
    unsigned int Count = 0;
    flag of the int = 0;
     
    / * initialize and load resources * /.
    If (InitCVIRTE (0, argv, 0) == 0)
    Returns - 1;
    If ((panelHandle = LoadPanel (0, "Timer.uir", PANNEAU)))<=>
    Returns - 1;
     
    / * display of the control panel and run the user interface * /.
    DisplayPanel (panelHandle);
    While that (is FALSE) {}
            
    GetUserEvent (1, & eventPanel, & eventCtrl);

    Switch (eventCtrl) {}
    case PANEL_Add: flag = (flag == TRUE)? FALSE: TRUE;
    SetCtrlAttribute (panelHandle, PANEL_TIMER, ATTR_ENABLED, flag);
    SetCtrlVal (panelHandle, PANEL_LED, flag);
    break;

    case PANEL_TIMER: SetCtrlVal (panelHandle, PANEL_Counter, Count ++);
    If (Count > 19)
    Count = 0;
    break;
    }
    }

    / * Cleanup * /.
    DiscardPanel (panelHandle);
    CloseCVIRTE ();
    return 0;
    }

    and here's the .h file

    ==================================

    #include

    #ifdef __cplusplus
    extern "C" {}
    #endif

    #define PANEL 1
    #define PANEL_Counter 2
    #define PANEL_Add 3
    #define PANEL_LED 4
    #define PANEL_TIMER 5

    #ifdef __cplusplus
    }
    #endif

    Hello

    According to aid GetUserEvent Gets the next validation event or an event defined by the programmer of the GetUserEvent queue. A validation event occurs when the user changes the State of a hot water or validate controls or selects a menu item.

    Place the events defined by the programmer in the GetUserEvent queue by calling QueueUserEvent.

    Because the timer does not generate a validation event, you must call QueueUserEvent; to do this, you will need to use the TimerCallback function that you don't like... I see no other way than to use the timer callback function

  • Help for DeclareThreadSafeScalarVar

    I have problems using DeclareThreadSafeScalarView. In my header file, I have the following:

    DeclareThreadSafeScalarVar (int, RunUserInterface);

    I have two source files different procedures I refrence the variable 'RunUserInterface. In a single file where my

    thread is created, first of all, I make a call to 'InitializeRunUserInterface()' and ' SetRunUserInterface (0) ' in a procedure and in

    another procedure in this file, I call "GetRunUserInterface()". In the second source file, I call "SetRunUserInterface (1).

    The two files compile ok, but when the executable in CVI binding takes place, I get link errors saying there are cases

    of "Undefined symbol" for each of the calls. I looked through the help of CVI screens and do not see what I

    can hurt. Can anyone answer why I have these errors of link?

    I just happen to google and find another forum on the use of DeclareThreadSafeScalarVar and ran into my problem. The NOR

    manuals did not mention the use of the present with the DefineThreadSafeScalarVar statement. I made an assumption that if I made a

    then I was covered. I didn't know that the two statements must be used together. The statement declared in the include file

    and the declaration defined in the source file where the InitializeVar is used. I put set it in my source and built my executable

    without any error link. Thanks for your previous answer.

  • Active button

    Hello everyone.
    I put a button in the user interface that is associated with the reminder "stop". I need to get out of an emergency procedure, but unfortunately when my software performs some operations if I click the button nothing happens. Can you help me?
    Thank you.

    It is a classic problem with GUI applications based.

    GUI events are handled on the same thread as the GUI Panel.  So, if you have this thread doing something, is not GUI events and your treatment STOP command is unresponsvie.

    If you could:

    1. whenever you have the GUI thread (usually the hand) do something, do it regularly to call a function ProcessSystemEvents() to be able to respond to a GUI event and run your STOP command callback function.

    2 create a thread of 'work' to go off and do the surgery, leaving your main thread available to process GUI events i.e. RunUserInterface().  When the user wants to STOP, the main thread see quickly and noted the worker or threads to stop or even put an end to them directly.  It's the design model more common for this problem.

    3 create a panel separated with the STOP command on this issue, load this Panel from a secondary thread and then have this secondary loop of thread on the verification of the State of the control and react when the SHUTDOWN command is used.  You must be careful not to simply spinlock on the State control in order to do not consume a lot of CPU bandwidth.  I used this with a high priority thread track, most of the time to sleep but wake every 100 msec or then check and see if the STOP control has been clicked.  Once there, you can have this second vault of thread of the test system (beware of conflicts of resources), or it can indicate to the main thread to stop it (but this kind of pose the question) or he may try to leave the process.  You must make sure that the end of the process to close unexpectedly when you think it does, it is possible to crash with a call to ExitProcess().  You can use TerminateProcess() or ExitProcess(), but you should learn about the differences between these two functions.

    Windows threading model hosts 'user interface' threads that deal with GUI events off the coast of the queue of messages, as well as "work" threads that don't.  But, the CVI event model does not provide this distinction.

  • TestStand freezes when calling user interface

    Hello

    I did a bit of seraching but the problem I have is intermittent for one of the positions that I have found useful. I have a built in CVI user interface that is called the part edit-a type of step in time. When I call the UI for several times now (same step over and over) TestStand eventually freezes. Sometimes I get error messages, most of the time that it just hangs. When she throws and error, it is usually a one .NET. I received this message before the "object reference is not attached to an instance of an object", so that system level exceptions. I can't figure out exactly what is the cause. I posted my code below. If I comment on either of the two sections "BOLD" no error occurs. Also, if I do not change the setting in the user interface between the calls to the user interface I have never it freezes. So he definitley has something to do with the fill/adjustment control of the ring, or even reading the property 'ThisContext.Step.ConfigProperties.ParameterID' of TestStand. If I get more descriptive errors, I will update this post.

    Code:

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    void __stdcall __declspec(dllexport) ReadParameterTSEdit (CAObjHandle seqContextCVI, char reportText [1024], short * errorOccurred, long * errorCode, char errorMsg [1024])
    {
    ErrMsg errMsg = {'\0'};
    int hpanel;
    int executed;
    int index;
    int count;
    int numParams;
    char paramIDs [100] [64];
    char param [64];
    char indexparam [64];
    char * ActCntrlTLA = NULL;
    char * temp = NULL;
    char activecntlr [23] = "active controller: ';"
    VBOOL CntrlExists;
    TSObj_Property paramids = NULL;
    TSObj_PropertyObjectFile propObjFile;
    CAObjHandle seqfileobj;
       
    Check that the system has been initialized and a profile was loaded!
    TS_PropertyExists (seqContextCVI, NULL, "ThisContext.FileGlobals.ActCntrlTLA", 0, & CntrlExists);
    If (!.) CntrlExists)
    {
    MessagePopup ("read setting", "no profile has been loaded for this sequence!");
    GoTo error;
    }
    TS_PropertyGetValString (seqContextCVI, NULL, "ThisContext.FileGlobals.ActCntrlTLA", 0, & ActCntrlTLA);
    Initializes the parameter reading UI
    hpanel = LoadPanelEx (0, "ReadParamUI.uir", READ_PARAM, __CVIUserHInst);
     
    TS_PropertyGetPropertyObject (seqContextCVI, NULL, "ThisContext.FileGlobals.ParamIDs", 0, & paramids);
    TS_PropertyGetNumElements (paramids, NULL, & numParams);
     
    for (count = 0; count)< numparams;="">
    {
         TS_PropertyGetValStringByOffset (County of paramids, NULL, 0, &temp);)
    strcpy (param, Temp);
    InsertListItem (hpanel, READ_PARAM_PARAMETERS, count, param, count);
    }

    Build a string them of active controller
    strcat (activecntlr, ActCntrlTLA);
    SetCtrlVal (hpanel, READ_PARAM_ACTIVETLA, activecntlr);
     
    TS_PropertyGetValString (seqContextCVI, NULL, "ThisContext.Step.ConfigProperties.ParameterID", 0, &temp);)
    strcpy (param, Temp);
     for (count = 0; count)< numparams;="">
    {
    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, count, temp);
    strcpy (indexParam, Temp);
    If (strcmp (indexParam, param) == 0)
    {
    SetCtrlIndex (hpanel, READ_PARAM_PARAMETERS, count);
    GoTo done;
    }
    }
    Fact:
     
    The display panel and run the user interface
    Does not return until that of RunUserInterface until the
    you press the Finish"" button.
    DisplayPanel (hpanel);
    Run = RunUserInterface ();
    Get the index of the selected parameter
    If (run<>
    {
    GetCtrlIndex (hpanel, READ_PARAM_PARAMETERS, &index);)
    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, index, param);
    TS_PropertySetValString(seqContextCVI,,"ThisContext.Step.ConfigProperties.ParameterID",0,param);
    }
     
    Output:
    / * Release resources and return * /.
    DiscardPanel (hpanel);
    TS_PropertyGetPropertyObject (seqContextCVI, NULL, "ThisContext.RunState.SequenceFile", 0, & seqfileobj);
    TS_SeqFileAsPropertyObjectFile (seqfileobj, NULL, & propObjFile);
    TS_PropertyObjectFileIncChangeCount (propObjFile, NULL);
    If (& ActCntrlTLA)
    {
    CA_FreeMemory (ActCntrlTLA);
    }
    If (& temp)
    {
    CA_FreeMemory (temp);
    }
    If (& paramids)
    {
    CA_DiscardObjHandle (paramids);
    }
    CA_DiscardObjHandle (propObjFile);
    CA_DiscardObjHandle (seqfileobj);
     
    Error:
    }

    /*---------------------------------------------------------------------------*/
    / * Callback functions * /.
    /*---------------------------------------------------------------------------*/

    int CVICALLBACK Done(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
    If (event is EVENT_COMMIT)
    {
    QuitUserInterface (0);
    }
    return 0;
    }

    int CVICALLBACK CLOSEPANEL(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
    If (event is EVENT_COMMIT)
    {
    QuitUserInterface (1);
    }
    return 0;
    }

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    Thank you

    Josh

    The problem was with this line:

    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, count, temp);

    I shouldn't have been past at the time to write the label that I had previously used temp with functions of API of TS. Who should have caught before posting... but it's been a long day.

  • on the timing and the GUI control loop

    Hi all

    I have a code with two buttons placed on the Panel, one is EXECUTED, another is STOP. Initially, STOP is disabled and when I launch RUN, the JUDGMENT will turn off. But when the JUDGMENT is made, the RACE will be activated.

    #include "testimg.h"
    
    #include 
    #include 
    #include "asynctmr.h"
    #include 
    #include 
    #include 
    #include 
    #include "toolbox.h"
    
    static int panelHandle = 0;
    
    static int stoprun = 0;
    
    int main (int argc, char *argv[])
    {
        int error = 0;
    
        nullChk (InitCVIRTE (0, argv, 0));
        errChk (panelHandle = LoadPanel (0, "testimg.uir", PANEL));
    
        SetCtrlAttribute(PANEL, PANEL_STOPBUTTON, ATTR_DIMMED, TRUE);
    
        errChk (DisplayPanel (panelHandle));
        errChk (RunUserInterface ());
    Error:
        if (panelHandle > 0) DiscardPanel (panelHandle);
        return 0;
    }
    
    int CVICALLBACK MainPanelResponse(int panel, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event == EVENT_CLOSE) QuitUserInterface (0);
      return 0;
    }
    
    int CVICALLBACK RunButtonResponse (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event==EVENT_COMMIT)
      {
        int N=20;
    
        stoprun = 0;
        SetCtrlAttribute(panel, PANEL_STOPBUTTON, ATTR_DIMMED, FALSE);
        SetCtrlAttribute(panel, PANEL_RUNBUTTON, ATTR_DIMMED, TRUE);
        for (int i=0; i0) break;
        }
        SetCtrlAttribute(panel, PANEL_STOPBUTTON, ATTR_DIMMED, TRUE);
        SetCtrlAttribute(panel, PANEL_RUNBUTTON, ATTR_DIMMED, FALSE);
      }
    
      return 0;
    }
    
    int CVICALLBACK StopButtonResponse (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
      if (event==EVENT_COMMIT)
      {
        stoprun = 1;
      }
      return 0;
    }
    

    My code is a repeat for N times, once the START button is kicked. And if the STOP button is started until the task has finished running. Stop the current application and returns the value false. I wrote the code, but it seems does not work. It seems that the application cannot be interrupted before the file for the task. I don't know what's wrong with my code. If you have any experienence with this, could you please tell me what is the problem with my cdoe? Thank you.

    What you see is the expected behavior: in your loop inside the run key, you have a 5 second wait in which the system is frozen, then another 2 sec with the system frozen again. For the simulation need, you must change the code this way:

    double tini;
    
    tini = Timer ();requestToStop = 0;
    while (Timer () - tini < 5.0 || requestToStop) {
      ProcessSystemEvents ();
      sleep (50);
    }
    

    The stop button then must trigger a global variable that stops the loop (requestToStop in my example above).

    In actual code, such a long-term process should not be handled within a control reminder: you will need to place it elsewhere depending on how you want to structure your code in order to let the user interface responsive. Available alternatives are:

    -A reminder of timer UI

    -A reminder asynchronous timer (similar to the preceding but executed in a separate thread)

    -A separate thread issued with CmtScheduleThreadPoolFunction

    If this date is the solution, the stop button must be manipulated inside the code by triggering a signal enabling the treatment stop securely.

Maybe you are looking for

  • MS Word 2003 not opening

    Bought a Toshiba A100-147 four days back. Installing Microsoft Office Professional 2003, but Word does not open. Excel, Powerpoint, Access are all working well. I really need MS Word to work on this laptop. Can someone please help? In addition, the l

  • How WLan antenna is installed in Qosmio G50 - 10H?

    I am trying to connect a D - Link DIR-855 to the build in WIFI Link 5100 G50 and impossible to get a higher connection then 150Mbps. According to v. pre - N antenna specifications at least 3 2.0 is necessary for longer range then 150Mbps. So my quest

  • This chipset is Satellite L300-110 uses & software question

    I have two main questions: 1. I just want to know what kind of chips is being used in the Toshiba Satellite L300-110, so I will know if you want to enable AHCI or RAID/AHCI only? 2. I used to have some software bundle with my MS Vista OS installed re

  • The graphic tape offset obscures data

    Im a beginner and can't get my stripchart to display data as a graphic of the band. Ive tinkered with graphic story length, sampling frequency, scale and others but the data seem to scroll to the end of the array and then my signal changes are no lon

  • BIOS Post beep continuously after the replacement of keyboard

    On my laptop G60 - 243 cl I swapped to a new keyboard that had the same part number 502958-001 "HP Spare", but when I first power to the top of my laptop, it beeps on an ongoing basis until I hit the ESC key or enter one or two times, and then Window