LPM: Q: End a process/program under NT?
Rich Bowen
rbowen at rcbowen.com
Fri Feb 4 15:23:52 CST 2000
llang at baywestpaper.com wrote:
>
> Having only (thus far) used Perl for general text wrangling and input
> mutilation, and not being able to dig in and use it on a daily basis to
> learn the proverbial finer points of it, I now find myself faced with the
> following:
>
> We have a process that runs in the system tray under NT. I'd like to be
> able to shut it down, but do so kindly. In essence, I want to send it the
> equivalent of an ALT-F4 (I guess that'd be an exit signal??) Doing that
> will make it shut down all of it's internal comm threads in the proper way
> and such niceties. Can someone push me in the direction of the right
> module to look at (Win32::{OLE || Process || other}) and a general run-down
> of how-to? (Bear in mind that I've never had cause to do process
> manipulation/management before and that I'm a reluctant NT newbie.) :-)
Although the docs are less than wonderful, Win32::Process looks like it
might be the way to go. You can do a Win32::Process::KillProcess($pid,
$exitcode) to kill a process, if you know the PID. It also appears that
you can use Win32::PerfLib to get the process ID, given the name. Or at
least get a list of processes, from which you can select the one that
you're interested in.
Rich
--
http://www.ApacheUnleashed.com/
Lexington Perl Mongers - http://lexington.pm.org/
PGP Key - http://www.rcbowen.com/pgp.txt
More information about the Lexington-pm
mailing list