LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid control ID after version upgrade from 8.0 to 8.5

I have upgraded from V8.0 to V8.5 because I wanted access to the "EVENT_LEFT_MOUSE_CLICK_UP". Since I have done so, I get a NON-FATAL RUN-TIME ERROR: The error is a Library function error (return value==-13[0xfffffff3]). Invalid control ID.

None of my control ID's have been changed. I experience this error whenever a GetCtrlVal or SetCtrlVal function is used. (I have selectively commented out parts of code to confirm this).
0 Kudos
Message 1 of 7
(4,791 Views)
Hello Kazinoz,

Do you have any of these get/setctrlval calls outside of the switch statements in your callback routines, such as below?

int CVICALLBACK UPDATE_NUMERIC (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
   
    double number =0;
    GetCtrlVal (panelHandle, PANEL_NUMERIC_2, &number);
   
    switch (event)
    {
        case EVENT_LEFT_CLICK_UP:
            SetCtrlVal(panelHandle, PANEL_NUMERIC, number);
            break;
        case EVENT_RIGHT_CLICK:

            break;
    }
    return 0;
}

This is often a mistake that is made that can lead to the Invalid Control ID error.  Unless you have functions that you want to be called for every event generated, (including EVENT_DISCARD etc.)  they should be inside the case that you want them to be handled within. 

If this is not the case, could you perhaps post a snippet of code that causes the error you are seeing along with a description of when this event is triggered, as well as what the expected behavior is? 


NickB
National Instruments
Applications Engineering
0 Kudos
Message 2 of 7
(4,757 Views)
No none of the get/setctrlval calls are outside of the switch statements in my callback routines. Re-generating the uir file has solved the problem. So far I have only re-done one of about 8 panels in the project but having lost about 4 days of productivity, I was desperate. I have attached a zip file of the project which controls a turntable in a small anechoic chamber. There is 3 USB 6501's and 1 USB6008 to control azimuth, elevation and height of the turntable as well as rotation of the source antenna. There is also a screen capture of the fault and the particular section of code that generated the error.
I have un-installed CVI V8.0, un-installed CVI 8.5, re-installed CVI 8.5. That didn't solve it, I wondered if it was a NIDAQmx problem so unistalled and re-installed that, cleaning up registry problems along the way. There is something about the version 8.0 uir file that is causing the problem, I feel.
On that same note, is there any way of copying a panel in the uir from one version to the other, easily?
0 Kudos
Message 3 of 7
(4,737 Views)

Hello kazinoz,

I couldn't run your project because I don't have the same DAQ configuration as you, but I'm pretty sure I know why you're having this problem. You're passing the wrong value as the panel handle to SetCtrlVal. You're passing TESTPANEL (this is the panel resource ID from new85.h) when you should instead be passing TestPanel (the panel handle that is returned by the LoadPanel call in main). This might have worked in a previous iteration of the .UIR because, by sheer luck, the order of the panels in the .UIR was such that the numbers were the same. But obviously, you can't rely on that.

The fact that the error is "invalid control ID" instead of "invalid panel handle" is unfortunate. The reason for that is because (again, by coincidence), that TESTPANEL resource ID happens to have the same value as the handle of some other panel, one which does not contain a control whose ID is 34 (TESTPANEL_BRAKE_STATUS). So the SetCtrlVal function thinks that you're passing a bad control, and not a bad panel.

You don't have to regenerate any of your .uir files. You just have to pass TestPanel instead.

Luis



Message Edited by LuisG on 03-14-2008 11:23 AM
0 Kudos
Message 4 of 7
(4,720 Views)
Hello Kazinoz,

One further thing to mention on top of what Luis mentioned.  It appears that your project has lost it's link to the UIR file that is referenced in the project.  In your source, you specify to #include new85.h.  However, the name of your UIR file is new8_5uir.uir, which means that any updates made to this UIR generate a new .h file, new8_5uir.h.  If you were to reference this header file instead of new85.h, you would now be referencing the correct header file for the UIR file you are using in your project.  However, I don't think this would be then end of the issue, because the UIR file in your project does not contain the control BRAKE_STATUS. 

To summarize, it is important to make sure that you are including the header file that is named the same as your UIR file.  Let us know if you have any further questions!

NickB
Applications Engineering
National Instruments
0 Kudos
Message 5 of 7
(4,685 Views)
Thankyou, problem solved.
0 Kudos
Message 6 of 7
(4,676 Views)

Hi,

 

I experienced the same problem after migrating an old project (I guess it was created in 8.6) to CVI2012. I changed the control IDs which were causing the problem with Ctrl + T on the corresponding panel. Then problem solved.

0 Kudos
Message 7 of 7
(3,511 Views)