Hi again, I am obtaining the PID via Dave Roth's code from proclist.pl :
# WMI Win32_Process class $CLASS= "winmgmts:{impersonationLevel=impersonate}$machine\\Root\\cimv +2"; $WMI= Win32::OLE->GetObject($CLASS) || die; foreach my $process (sort {lc $a->{Name} cmp lc $b->{Name}} in($WMI->I +nstancesOf("Win32_Process"))) { if($process->{Name} eq 'GravitixService.exe' || $process->{ProcessID +} eq 'Gravitix.exe') { # Store the Gravitix process ID $pid= $process->{ProcessID}; } }
The PID ($pid) I get from this method is valid, I have verified that it is via a simple fkill on that PID.
But, the following scenarios still do not work i.e. the process remains up and no kill operation appears to go through. I am coding on a Windows 2003 machine :
kill method #1
my $x= Win32::Process::KillProcess($pid, $exitcode);
result -- nothing, process is not killed
value of $x = 26423748


kill method #2
my $y= Win32::Process::Open($p_obj, $pid, 0); $p_obj->Kill(0);
result -- nothing, process is not killed
value of $y= 0

I am at a loss as to WHY KillProcess is doing nothing in method #1, and in the case of method #2, why are Win32::Process:KillProcess and Win32::Process::Open both returning 0 ??

In reply to Re: Re: Re: Re: Win32::Process::KillProcess by jimbobfurley
in thread Win32::Process::KillProcess by jimbobfurley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.