From: "RL" <[EMAIL PROTECTED]>
> I am new and am lost with  Win32::Process stuff.
> 
> I want on perl script to start a process, then another perl script to
> terminate the same process.
> -------------------------------------------------------
> I can search for that process using...
> -------------------------------------------------------
> use Win32::Process::Info;
> $pi = Win32::Process::Info->new();
> @pids = $pi->ListPids ();      # Get all known PIDs
> @info = $pi->GetProcInfo ();   # Get the max
> %subs = $pi->Subprocesses ();  # Figure out subprocess relationships.
> for $pid (@info){
>    print "-----------------------\n";
>    print $pid->{"Name"}."\n";
>    print $pid->{"CreationDate"}."\n";
>    print $pid->{"ExecutablePath"}."\n";
>    print $pid->{"KernelModeTime"}."\n";
>    print $pid->{"MaximumWorkingSetSize"}."\n";
>    print $pid->{"MinimumWorkingSetSize"}."\n";
>    print $pid->{"ProcessId"}."\n";
>    print $pid->{"UserModeTime"}."\n";
> 
>   if ("$pid->{\"Name\"}" eq "notepad.exe") {
>      $gotit = $pid->{"ProcessId"};
>      print("Found notepad.exe with pid $gotit\n");
>   }
> }
> -------------------------------------------------------
> So what is the next step to actually terminate it?

Quick glance into the Win32::Process's docs:

    $ProcessObj->Kill( $exitcode )
       Kill the associated process, have it terminate with exit code
       $ExitCode.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to