Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Threads and invalid control ID?

I have written my first program using multi-threads. Everything was working well up until last evening. I started getting invalid control ID error messages on lines of code which write to a text box that have been working for weeks. An example is below:

                SetCtrlAttribute (tabPanelEngrg, TAB_ENG_MSG, ATTR_CTRL_VAL, bfr);

Because this SetCtrlAttribute works OK some places, I suspect that I have violated some sharing between threads. The area of most changes in the past 24 Hrs has been in standard serial port code. Would this be a common symptom of thread violation? It seems that TAB_ENG_MSG shouldn't become invalid because it is a compiled in constant. Possible the tab panel handle is being corrupted.

Any comment or help on this?

I have read the two tutorials on threads. Are there any quick "rules of thumb" for writing threads.

Tahnks,
Doug Wendelboe
Solyndra Inc.
Fremont, CA



0 Kudos
Message 1 of 2
(2,977 Views)
Hi Doug,

Are you using
 int GetPanelHandleFromTabPage (int panelHandle, int controlID, int index, int *tabPanelHandle);
to get access to the handle for that particular Tab page, as in this KnowledgeBase Article:
Access a Control Located on Inactive Tab in CVI
http://digital.ni.com/public.nsf/allkb/926C2110737BEC9886257410005B5E30?OpenDocument

Can you tell me a little bit about how your program is architected so I can have a better idea of what is going on here. 

Also, are you able to narrow down your program into something smaller that exhibits this problem?  If so I could take a look at it and see if I find anything that could be causing problems.

 
Kristen
National Instruments
0 Kudos
Message 2 of 2
(2,941 Views)