PS (Process Status) for Windows 95 and Windows NT

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

A PS (Process Status) program for Windows 95 and Windows NT. This is a
program to list all the active processes under Windows 95 or Windows NT.
It lists each program’s full path name and Process ID. If you run it
with no command line arguments, it displays the output on the console.
If you supply an argument (regardless of what it is) it displays the
output in a Listbox instead.

In addition, a simple “kill” command is included. If you type “kill”
followed by the Process ID shown in the PS display, that process will be
killed (unless it’s a 16 bit Windows task, which would require a bit
more work.) When using KILL, you can use hex, decimal or octal for the
Process ID, following the normal C conventions — a prefix of “0x”
indicates hex, a prefix of `0′ indicates octal, and no prefix indicates
decimal.

Contents:


Full source code.


VC++ 5.0 SP3 project files. (untested with earlier versions)


hand-written makefile for command line builds.

Installation:

Unzip the ps_src.zip into a directory of your choice. Assuming you
have VC++ correctly intalled, switch to that directory and type
nmake. The executable should come to a bit under 8K.

If you use the VC++ project files, you’ll probably get a message
telling you that the project has been moved — this is normal unless
you happen to pick exactly the path name to put it in that I used.

Known bugs:

1) Under NT, DOS programs are not displayed. (16 bit Windows
programs are…)

2) If you attempt to use the PID supplied for a 16 bit Windows program
under NT to kill the program, killing the program will fail unless
the kill program takes the special nature of the program into
account. (You can kill the NTVDM that the Windows program runs under,
and with sufficient code, you should be able to kill the Windows
program by itself as well, but I don’t know of a kill program that
does so.)

This code was written by Jerry Coffin. It is hereby released into the
public domain. Since the program is free, I provide no guaranty or
warranty of any sort with it. However, if you report any bugs to
[email protected], there’s a reasonable chance I’ll try to fix them when
I get a chance. Have fun.

Later,

Jerry.

Download demo project – 5KB

Download source – 16KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read