LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

call RunUserInterface() more than once may cause fault?

i have a program on CVI5.5. my uir files have many panels,one of them is the main panel. in main() i call RunUserInterface() to make the control on main panel accessible. then if the user choose some function ,another panel will popup,then i call RunUserInterface() again to make controls on that panel accessible(is this not necessary?),the problem will happen, that is do nothing for a long time such as an hour,the system seem to be hang up and mouse click can't be answered.why do this thing happen?
need your help,thanks in ahead!
0 Kudos
Message 1 of 6
(3,562 Views)
RunUserInterface is a while loop that forever calls ProcessSystemEvents() until QuitUserInterface is called. You should only be calling RunUserInterface once because any event on any panel (that is in the same thread) will be enqueued in the same message queue. You do not need to call RunUserInterface for every panel you have. Hope this helps!
Jeremy L.
National Instruments
Message 2 of 6
(3,549 Views)
I have known there is no need to call RunUserInterface() more than once. i programmed some examples to test it.Thanks a lot!
But i really want to know if i did such thing ,what would happen(or maybe unpredictable things would happen)? for my program is not working well, i have to work it out. Maybe this is the reason,maybe it isn't.i think you know what i mean.
wish for your apply,thanks again!
0 Kudos
Message 3 of 6
(3,529 Views)
As mentioned in the previous replies, RunUserInterface() need not be called more than once. If you do that as the thread was already started it hangs. For controlling the panels on the UserInterface thread you can use the functions such as DisplayPanel(int panel_id);,DiscardPanel(int panel_id);,HidePanel(int panel_id);,NewPanel(int panel_id); ..etc

Regards,
Siddu
Message 4 of 6
(3,507 Views)
If you call RunUserInterface more than once, it's really an undefined behavior, because then you'll have two loops running and taking messages off of the queue. You may end up in some point where more than one message is being processed (in 2 callbacks simultaneously) which may end up in a failure. Also, you may end up in an odd state of execution where more problems would arise.
Jeremy L.
National Instruments
Message 5 of 6
(3,500 Views)
I really appreciate for your help,i will check my program to solve the problem.
0 Kudos
Message 6 of 6
(3,488 Views)