R
RL
Hi all,
I am new and am lost with Win32:rocess 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:rocess;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32:rocess::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:rocess::Info;
$pi = Win32:rocess::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");
}
}
I am new and am lost with Win32:rocess 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:rocess;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32:rocess::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:rocess::Info;
$pi = Win32:rocess::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");
}
}