07-13-2011 02:27 AM
Hi all,
I was wondering if there is a way to close the LabVIEW.exe from the command line. I came accross the taskkill command but also i found that it doesn't close the application properly and may later on lead to LabVIEW crash.
Why I want to do this is because I am developing an application which needs LV 10.0 to be running on the computer. So it will check which LV version is running and if it is not 10.0 it has to close the LabVIEW.exe and open the 10.0 version of LabVIEW.exe.
Now I know how to open LabVIEW.exe using System exec.vi but can anyone tell me how to close LabVIEW.exe using the same.
P.S: I can't use the Quit LabVIEW function as well because it will close my application.exe itself.:(
Warm Regards,
Nitzz
Solved! Go to Solution.
07-13-2011 04:13 AM
Does this thread help?
Perhaps you could look for LabVIEW.exe in task manager (assuming you're on Windows) and end it that way using in the windows utilities?
Ian
07-13-2011 04:20 AM
Hi Ian,
Thanks for the reply. I downloaded the vis attached in that thread but i was not able to open it. Anyway, I think that's the primitive version of the Quit LabVIEW tool which will exit the Application.exe as well. I guess I'll have to go ahead with the taskkill command in the Windows command line. Though I am not sure about the ill effects of using this command.:)
Thankful Regards,
Nitzz
07-13-2011 04:58 AM
Using VI server you could bring the application to the front, the you could send a Ctrl+Q using the Windows user32.dll.
I didn't try it, so I don't know if this will work.
To send Ctrl+Q press Ctrl, then press q, release q, release Ctrl. A VI that wraps the user32.dll call can be found here: http://forums.ni.com/ni/attachments/ni/170/401417/1/Simulate%20Keyboard%208.5.vi
To avoid a pop-up asking if you want to save unsaved VIs you might have to close them all first using VI server.
07-13-2011 04:59 AM
Hi Nitzz,
I see what you mean - I had a play and have pulled out the files that are relevant. I tried building an exe and it does indeed seem to close LabVIEW.exe leaving any compiled exes running , although if you have unsaved or running VIs, it will pop up user dialogs... might help though.
The top leve file you need to run is 'quit application.vi'... obviously running it in the development environment will end itself!
Good luck!
Ian
07-13-2011 05:16 AM
Hi Ian and dan,
Thank you both. Your posts helped me a lot..
Regards,
Nitzz