I'm working on an app that periodically needs to execute outside procedures. Ideally, I want to launch the outside procedure in "fire and forget" mode; that is, I do not want to wait for the outside process to terminate.
I ALREADY HAVE some code that does this (see below). My question is- is there a way to periodically poll the outside process to determine if it is still running? I've tried a few things already and none of them work. ================= the code ================= use strict; use warnings; use Win32::Process; # Parameters for the Win32::Process::Create function: # # Process This is an empty string that will receive # a process ID used to address the child process. # Returns a string that looks like this: # "Win32::Process=SCALAR(0x235478)". # # fullPath The full path to the program including the # program name and extension. Can be UNC. # # newArg The name of the program itself with an extension, # but no path. Also, command line arguments go here. # # inheritHndls Should the child process inherit the parent's file handles? # # flagsx OR'd combination of the flags listed above. # # dirx Startup directory for the child process. # my $process = ''; my $dirx = '.'; my $inheritHndls = 0; my $newArg = 'notepad.exe'; my $fullPath = "c:\\windows\\system32\\$newArg"; my $flagsx = DETACHED_PROCESS | NORMAL_PRIORITY_CLASS; if (my $spawnhndl = Win32::Process::Create($process, $fullPath, $newArg, $inheritHndls, $flagsx, $dirx)) { my $pid = $process->GetProcessID(); print "Child process returned PID: $pid\n"; } else { my $errormsg = Win32::FormatMessage(Win32::GetLastError()); print "Failed to launch process $fullPath: $errormsg\n"; } _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs