467,858 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,858 developers. It's quick & easy.

LOST - Win32::Process

RL
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 :)
Jul 19 '05 #1
  • viewed: 4696
Share:
1 Reply
terminate = kill

hth,
eokyere
Sep 5 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Guy | last post: by
reply views Thread by Carlo Filippini | last post: by
1 post views Thread by rob | last post: by
2 posts views Thread by Paolo | last post: by
1 post views Thread by Java and Swing | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.