Click here to get back home

Win32::Process Kill Process in Windows ME

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Win32::Process Kill Process in Windows ME Stefan Mueller 04-13-2005
Posted by Stefan Mueller on April 13, 2005, 1:49 am
Please log in for more thread options


Hello,

I want to kill a Process in Windows ME, which I have started. I have
executed the following lines in XP and it works. I execute this in ME,
the process starts but it won't be killed.

Win32::Process::Create($ProcessObj,
"C:\Program Files\Internet
Explorer\iexplorer.exe",
"iexplore temp.txt",
0,
NORMAL_PRIORITY_CLASS,
".")|| die ErrorReport();

$ProcessObj->Kill(1);

Is there a possibility to kill processes in Windows ME?

Thanks in advance.

Stefan


Posted by Sisyphus on April 13, 2005, 8:21 pm
Please log in for more thread options



> Hello,
>
> I want to kill a Process in Windows ME, which I have started. I have
> executed the following lines in XP and it works. I execute this in ME,
> the process starts but it won't be killed.
>

What actually happens ? Does the script hang .... or exit silently .... or
..... ?
Do you get any warnings or error messages ?

use warnings;

> Win32::Process::Create($ProcessObj,
> "C:\Program Files\Internet
> Explorer\iexplorer.exe",
> "iexplore temp.txt",
> 0,
> NORMAL_PRIORITY_CLASS,
> ".")|| die ErrorReport();
>

Not sure. Maybe (untested):

my $exitcode;
my $pid = $ProcessObj->GetProcessID();
Win32::Process::KillProcess($pid, $exitcode);
# $exitcode is set to the exitcode of the process.

Cheers,
Rob

--
To reply by email send to optusnet.com.au instead of nomail.afraid.org




Posted by Stefan Mueller on April 15, 2005, 1:00 am
Please log in for more thread options


Hello Rob,

Thank you for your answer.

> What actually happens ? Does the script hang .... or exit silently .... or
> .... ?
> Do you get any warnings or error messages ?

No, I get no error messages. The script doesn't hang, it exists like
the way on XP.

> use warnings;

no warnings

> Not sure. Maybe (untested):
>
> my $exitcode;
> my $pid = $ProcessObj->GetProcessID();
> Win32::Process::KillProcess($pid, $exitcode);
> # $exitcode is set to the exitcode of the process.

it's the same. What's about the exitcode? I have used 1 and 9, but
there is no difference.

Cheers,
Stefan


Posted by Sisyphus on April 16, 2005, 6:35 am
Please log in for more thread options



> Hello Rob,
>
> Thank you for your answer.
>
> > What actually happens ? Does the script hang .... or exit silently ....
or
> > .... ?
> > Do you get any warnings or error messages ?
>
> No, I get no error messages. The script doesn't hang, it exists like
> the way on XP.
>

I can't find any documented reason for the problem (and I don't actually
have a Windows ME to experiment with). KillProcess() calls OpenProcess() and
TerminateProcess(). I've checked the msdn docs for both OpenProcess and
TerminateProcess and there's no mention of any special considerations
regarding Windows ME.

If you want (and assuming you can compile Win32::Process from source) you
could try changing (in Process.xs):
HANDLE ph = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
to:
HANDLE ph = OpenProcess(PROCESS_TERMINATE, 0, pid);

(You'll find that about 5 or 6 lines from the end of the file.) I can't
really think of any reason that should help, however.

ActiveState now hosts a (low volume) libwin32-perl mailing list. Maybe
someone there can help. See:
http://aspn.activestate.com/ASPN/Mail/

Cheers,
Rob








Similar ThreadsPosted
Win32::Process, SetProcessAffinityMask for an existing process = perl crash May 7, 2006, 6:22 pm
kill process when file count reached,,. July 1, 2008, 7:25 pm
Problem in using Win32::Process::Create July 24, 2007, 6:25 am
Win32::Process::Create(vxsim) cmd line argument trouble December 17, 2007, 9:05 am
Getting the name of the process via the process ID December 14, 2004, 7:14 am
Process syncronization in perl? November 6, 2004, 5:10 pm
fork process help needed March 15, 2007, 8:56 pm
starting a background process via Net::SSH::W32Perl September 7, 2004, 10:41 am
CPAN module validation process July 19, 2007, 3:58 pm
Using Win32::OLE on 64 Bit Windows January 23, 2007, 7:01 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap