Example Code

.NET Example: Kill a Windows Application from LabVIEW

Code and Documents

Attachment

Download All

 

Overview:

Shut down a selected Windows application based on the name of the process.

Description:

This example kills other Windows applications like internet explorer, Firefox, etc from LabVIEW. In order to use this example, you will need to know the name of the process that corresponds to the Windows Application. For example, Internet Explorer's process is iexplore and Firefox is firefox. This code can shut down any process shown under Process in the Windows Task Manager, allowing you to monitor and control what applications are active on your computer when your LabVIEW code is running.

Steps to Implement or Execute Code:

  1. Determine the name of the process you want to end (as shown in Task Manager or the array indicator on the front panel of this program).
  2. Enter this name into the string constant attached to the element terminal of the Search 1D Array Function.
  3. Run the program.

Requirements:

  • LabVIEW 2012 (or compatible)

Additional Information or References:

killaprocessinLabVIEW.png

 

"**This document has been updated to meet the current required format for the NI Code Exchange.**"


Jim St
National Instruments
RF Product Support Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Torben Oestergaard-Andersen
Member
Member
on

Is the Process constructor accessible in earlier Labview versions (e.g 8.5) ?

laurent74380
Member
Member
on

Hi Jim,

Have you tested the Kill Excel process already?

It damaged my Excel installation and now as a consequence I can't open any Excelfile anymore and receive an error message instead... "There was a problem sending the command to the program". I'm using LV2012 and Win7-64bits

Thank you for your feedback.

Laurent

danny_t
Active Participant
Active Participant
on

HI,

I have been using a VI based on this for quite a while now and it has been working very nicely UNTIL.....now.

When you build an executable with the .NET Process constructor in it then on some PC's Windows 7 64 bit OS, on the first run the .NET create Prcess ref takes forever  during which time the whole LAbVIEW application hangs if you wait enought it then starts up again and works as expected. If you recall the same VI later there is no hang.

I do not know why this is happening and have had to abandon this method of taskkill

It is a shame. If anyone has any ideas. I believe I am running the same version of .NET framework on all machines

Danny Thomson AshVire Ltd