Hi all,

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 start a process using...
-------------------------------------------------------
    use Win32::Process;
    use Win32;
    sub ErrorReport{
        print Win32::FormatMessage( Win32::GetLastError() );
    }
    Win32::Process::Create($ProcessObj,
                                "C:\\windows\\system32\\notepad.exe",
                                "notepad temp.txt",
                                0,
                                NORMAL_PRIORITY_CLASS,
                                ".")|| die ErrorReport();
    $ProcessObj->Suspend();
    $ProcessObj->Resume();
    $ProcessObj->Wait(INFINITE);
-------------------------------------------------------
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?

Thanks in advance :)






-- 
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