I am able to connect to my process when passing in the process id which I obtained from processinfo.pl..(idea is to grab the new process id and pass it in and then use it to monitor process so it keeps running continuously or something.. )
process info code followed by my process.pl code which is just to connect and tell me exit code as I don't really know yet how to do anything with it.
stuff below code is ignorable.
use Win32::Process::Info;
use Data::Dumper;
$pi = Win32::Process::Info->new ();
$pi->Set (elapsed_in_seconds => 0); # In clunks, not seconds.
@pids = $pi->ListPids (); # Get all known PIDs
@info = $pi->GetProcInfo (); # Get the max
%subs = $pi->Subprocesses (); # Figure out subprocess relationships.
@info = grep {$_->{Name} =~ m/vugen/}
$pi->GetProcInfo (); # All processes with 'perl' in name.
#print $info;
#print $pi;
my $href=\%subs;
print Dumper $href;
print Dumper @info;
#print Dumper @pids;
use Win32::Process;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32::Process::Open($Obj,$pid=12732,$iflags)|| die ErrorReport();
print "connected to process $pid ";
$Obj->GetExitCode($exitcode);
print $exitcode;
that sounds very much like what I want to do but how can I do it on a winblows system..(er I mean windows). I am looking at win32 process, but it's not clear how to export "still-active" I manage to get a bit over my head on this one,how do I explicitly export? so far I haven't gotten much, trying to figure out how to tell if still_active or setup a heartbeat or something.
I can get it to launch but not to open my script.
use Win32::Process;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32::Process::Create($ProcessObj,
"C:\\program files\\Mercury\\LoadRunne
+r\\bin\\vugen.exe",
"E:\\Mibor_timingtest\\Mibor\\mibor.us
+r",
0,
NORMAL_PRIORITY_CLASS,
".")|| die ErrorReport();
Win32::Process::Open($Obj,$pid=11672,$iflags)|| die ErrorReport();
$ProcessObj->Suspend();
$ProcessObj->Resume();
$ProcessObj->Wait(INFINITE);
I am trying to figure this out has anyone used before? I get 259 as my exit code what does that mean?
use Win32::Process;
use Win32;
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32::Process::Open($Obj,$pid=11672,$iflags)|| die ErrorReport();
print "connected to process $pid";
#$ProcessObj->Suspend();
#$ProcessObj->Resume();
#$ProcessObj->Wait(INFINITE);
$Obj->GetExitCode($exitcode);
print $exitcode;