in reply to Win32::Process::KillProcess
This works for me taking the example of creating a process in the documentation for Win32::Process
#!/usr/bin/perl use strict; use Win32::Process; my $ProcessObj; Win32::Process::Create($ProcessObj, "C:\\winnt\\system32\\notepad.exe", "notepad temp.txt", 0, NORMAL_PRIORITY_CLASS, ".")|| die "Oops"; my $exit_code = 1; my $wait=<STDIN>; chomp $wait; $ProcessObj->Kill($exit_code);
Some tests in your code would be to print out some of the variables you are using and seeing what there values are so you know what is happening with your values. You are calling values for exit code that will not exist until the program exits.
Some references:
Using OLE
Win32::Process::Info
I would suggest using Win32::Process::Info to get the process ID and using Win32::Process to kill the process.
Specifically look at GetProcInfo (); and getting the name to search for the pid of a particualar application.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Win32::Process::KillProcess
by jimbobfurley (Novice) on Dec 19, 2003 at 20:13 UTC | |
by Ninthwave (Chaplain) on Dec 19, 2003 at 22:27 UTC | |
by jimbobfurley (Novice) on Dec 23, 2003 at 20:14 UTC | |
by Ninthwave (Chaplain) on Dec 23, 2003 at 21:54 UTC |