Example Code

Programmatically Stop an Executable

Code and Documents

Attachment

Download All

Overview

This example programmatically stops an executable using LabWindows/CVI.

 

Description

When run, this program will stop Notepad.exe in a similar way to Task Manager. The program iterates through each process until it finds one named "notepad.exe". It then terminates that process. If you want to change the process that is terminated, change the .exe named in line 33.

Steps to Implement or Execute Code

  1. Download and extract files from *.zip file
  2. Open *.prj file
  3. Open Notepad
  4. Run program, Notepad will close

Requirements

Software

LabWindows/CVI

Psapi.lib and Psapi.h (commonly found in C:\Program Files\Microsoft SDKs\Windows)

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

A_Ryan
AES
National Instruments

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

Comments
pe2
Member
Member
on

Where to get the psapi.lib and the psapi.h files?

Contributors