LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to see if a process is running in Windows Task manager?

Hi,
I want to detect if a specific process is running during my VI's execution in Windows 2000. The problem I am having is that I save data to an Excel template (via Active X) which closes the Excel application refnum after running. I don't want to close the application though if it was already opened previous to my saving the data (ie. the user had Excel opened before I reopened it to save the test data). My thought is if I could check to see if "Excel.exe" is running in the task manager then I could act appropriately and not close Excel when I saved the test data.

Does any one have an idea how to access Windows task manager? Is there another better way to deal with this problem of detecti
ng if the application is already opened?
Any help appreicated,
Thanks

Stephan
0 Kudos
Message 1 of 5
(8,919 Views)
Stephan,

The best way I can think of to solve this problem is to use the Windows API VIs for LabVIEW. They are available in the NI Developer Zone under the name "Windows API Function Utilities (32-bit) for LabVIEW". Specifically, there is a VI in the winevent.llb called "Get Task List" that returns the names of all the tasks currently running in the toolbar. You can just search each window name in a for loop for "Microsoft Excel" and if you find it, you'll know that Excel is running.

I hope this suggestion gets you started in the right direction. Good luck.

Darren
Message 2 of 5
(8,919 Views)
Thanks Darren,

Just glancing at the VI quickly and it looks like this will allow me to determine if Excel (or any app) is open.

Thanks again,
Stephan
0 Kudos
Message 3 of 5
(8,920 Views)
Nope. The "Get Task List.Vi" will tell you all open windows but not all processes running as displayed in the "Processes" Tab of the Task Manager. If you have an application running without window in the background then it will not appear in the "names of application windows" indicator.
I am still seeking a VI that can do the job,
Christophe
0 Kudos
Message 4 of 5
(8,919 Views)
Hi Stephan

I don't see in your post which LV version you're using, but if you have LV 7, then there is an example (Simple TaskMonitor.vi) which shows all processes that are running on your PC. You have to install the .Net framework for running this example.

Luca
Regards,
Luca
0 Kudos
Message 5 of 5
(8,919 Views)