LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get get the process list (Windows)

Hello,
i found the "Get Task List.vi" but this only shows me the applications.
Is there something similar which shows me also the processes?

(What i  want to do is killing a process.
I´m using the function "EndTask" from user32.dll which works fine for killing opened applications. The current problem is to get the handle of a process.)

Thx

Message Edited by NewOne on 09-15-2005 08:14 AM

Message Edited by NewOne on 09-15-2005 08:14 AM

0 Kudos
Message 1 of 15
(9,907 Views)

Maybe you could use an API or dll from this program.

http://www.microsoft.com/whdc/devtools/debugging/whatsnew.mspx

0 Kudos
Message 2 of 15
(9,893 Views)
It looks like psapi.dll should be able to return a string array with Enumprocesses, but I don't have a clue how to make it work with a Call Library Function Node.
 
0 Kudos
Message 3 of 15
(9,885 Views)
a different approach is using pslist from sysinternals.com, it's a dos program to display all processes (also in the package are the *very* handy psexec and pskill)
Run the pslist exe via the system exec vi and it's output will give you a string that is the full process list. It's not too hard extracting all info you need from it.
0 Kudos
Message 4 of 15
(9,880 Views)
Thx for the link but i cant find the mentioned  example (Simple TaskMonitor.vi) in my LV 7.1.1. Can you?

I tried to create a callLibraryFuntion from psapi.dll with "EnumProcesses" its attached.
I get the pbytesreturned with "156" but the Array of IDs stays empty.
0 Kudos
Message 6 of 15
(9,866 Views)
The function "EnumProcesses" also pnly returns the applications and not the processes.
The pbytesreturned with "156" divided by 32 is 5. And i hae 5 applications open.
When i close one application then the
pbytesreturned  is "144" / 32 = 4 (applications)
Hmm.
0 Kudos
Message 7 of 15
(9,864 Views)

Here is the path on my machine. It requires the .net framework to be loaded.

 

C:\Program Files\National Instruments\LabVIEW 7.0\examples\comm\dotnet\SimpleTaskMonitor.llb\SimpleTaskMonitor.vi

0 Kudos
Message 8 of 15
(9,861 Views)
Thx for the path. I found it. Ill try this as next.

I attached my "GetProcessList.vi" wgich now outputs also the process-IDs as array (funtion: get EnumProcesses).
Next step will be to get the name from this IDs
0 Kudos
Message 9 of 15
(9,854 Views)
Could you save that as 7.0 format. Thanks. Labview closes everytime I try to access the dll in a program.
0 Kudos
Message 10 of 15
(9,852 Views)