取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 5 条)
9,118 次查看
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
2 条消息(共 5 条)
9,118 次查看
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 项奖励
3 条消息(共 5 条)
9,119 次查看
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 项奖励
4 条消息(共 5 条)
9,118 次查看
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 项奖励
5 条消息(共 5 条)
9,118 次查看