473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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
1 4946
terminate = kill

hth,
eokyere
Sep 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Guy | last post by:
Hi, I created a function, which seems to work, quite well, it tells me if a process is running in widows using the pid number (I'm aware that the pid number in widows is not called a pid and this...
0
by: Carlo Filippini | last post by:
Hi on a XP machine I start a ftp process with: $pid = open (CMD, "ftp -in -w:1024 -s:$file_cmd $server 2>&1 |") or die "Can't execute: $!"; In some occasions I want to kill the process, but I...
1
by: rob | last post by:
I created some Perl scripts on Win32 platform, and now I want to support the same for Linux. What are the equivalents for: 1) use Win32::Process; 2) use Win32::Process::Info; 3)...
2
by: Paolo | last post by:
There is something I can't understand which is the following. I have a system command which runs a commandline to unzip a file: my $Out = system ( $rootPath."bin/bin/gunzip -dfc "....
1
by: Java and Swing | last post by:
i need to get information about the processes running on a windows pc (98, 2k, xp) i can get the pid's using, win32process.EnumProcesses()...and I can get a handle on a process using an id..such...
17
by: asearle | last post by:
Hallo everyone, After playing around with 'fork' in order to try to get a one process to monitor another, I have changed my tack and switched to Win32::Process. Indeed, it looks like this...
3
by: jbenezech | last post by:
Hi All, I have a perl script which starts a java process using Win32::Process. Here is the code to start the java proces: Win32::Process::Create($ProcessObj, ...
0
by: jbenezech | last post by:
Hi all , I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform...
1
by: Tension | last post by:
Hi, I am trying to run a Tornado simulator with Perl. The command line in an ordinary Windows command window looks like this: "C:\Tornado\target\config\simpc\vxWorks.exe /r32000000" Which I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.