LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting and Killing a process in Windows

I have looked at the utilities posted in Winevent.llb (from lvwinutil.zip in a previous discussion thread from way back in LabView 4!)
The TaskList function works fine, but there is a missing .vi "PostMessage Master.vi" in "Quit Application.vi"
 
Does anyone know where this is hiding?
 
Alternatively, is there another (better?) way of achieving this?
 
I need to detect the presence of a task and terminate it if found........
If the method will work on Windows 2000 AND XP, so much the better.
 
Ta....
0 Kudos
Message 1 of 5
(3,091 Views)
I have lvwutil library (though I don't use it), so I can verify that VI is in the WINUTIL.llb file. You may want to download the lvwutil library again from NI.
Message 2 of 5
(3,071 Views)

Thanks - found it.

I am also trying SystemExec.vi and calling the taskkill.exe directly -seems I can make it work both ways.

Now comes the trick - make it robust! - Cheers........

0 Kudos
Message 3 of 5
(3,063 Views)
I don't know how much more (or less) robust this would be, but you could also utilize the call library function node.  With Kernel32.dll, using the "TerminateProcess" function.

I don't know the 'find all processes' function offhand but I know it's in there.

Just an idea!
0 Kudos
Message 4 of 5
(3,057 Views)

Surprise, surprise, I'd recommend using .NET - much easier to work with in LabVIEW than Win32 - as long as you have LabVIEW 7.1 or later.

If you don't have it already, install .NET 2.0 or .NET 3.0 (just released).

Go to examples\comm\dotnet\SimpleTaskMonitor.llb and take a look. It's a large example, so don't get overwhelmed - but you should be able to pull out the basics on how to get the list of running processes via .NET. Then the Process object has a Kill() method you can use.

0 Kudos
Message 5 of 5
(3,016 Views)