LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Running CVI in background

I would like to write a CVI running at background without calling the front panel. The main function will call out a sub-function and the sub-function containing a while loop that keep doing the task. Anyway, after certain moment and running with another programs (eg: Outlook, ms word, ms excel etc), there's no respond from the CVI program (noticed by pressing CTRL-ALT-DEL) . I have set the "Syncwait" in the while loop and perform the "processsystemevent" statement. The problem is still there. Is there any opinion/solution can be provided regarding this issue? Thank you very much.
0 Kudos
Message 1 of 5
(3,548 Views)
Hello Baron,
It is difficult to tell exactly what you mean from you message, you may with to explain further. If you are not using a user interface or any of its components, then there is no reason to call ProcessSystemEvents. You also do not tell us what you loop is doing in the background. I would advise debugging the application and putting breakpoints in key locations. If this does not help, you may want to try putting in some print statements to log your program's progression to the screen or a file. I would recommend that before each function call, you print the function name as well as the values of all parameters passed. This program trace should aid you in tracking down the source of the problem.

Jeremiah
Applications Engineer
National Instruments
http://ww
w.ni.com/ask
0 Kudos
Message 2 of 5
(3,548 Views)
As someone else said I am not too sure what you are trying to do here. But... one method you could employ is to launch your "main" loop as a seperate thread, and have that running on its own. It could then call your sub-function, either in another thread of its own, or within the "main" thread.

The Front panel could then be loaded, and just before you run the user interface, you start your "main" thread. This will then run in the background until terminated eithe by completion of the "main" thread, or when you decided to kill it (not the preferred method). If you want anymore help, let me know and I can send a few examples of starting and controlling threads.

Regards

Chris
0 Kudos
Message 3 of 5
(3,548 Views)
Hello Shiner,
The method that you have mentioned looks good. I don't know whether it is applicable on CVI ver5.0. Anyway, I would appreciate it if you can send me some example. Thanks a lot.
0 Kudos
Message 4 of 5
(3,548 Views)
Will try and get something to you as soon as I get 5 minutes.

Chris
0 Kudos
Message 5 of 5
(3,548 Views)