14.5 Win32::Process
The most flexible way of starting a process on
Windows NT is to use the
Even though we haven't covered all of the relevant concepts, we are going to run through a
As shown, the use Win32::Process; Win32::Process::Create($Process, "c:\\nt\\system32\\notepad.exe", "notepad", 0, DETACHED_PROCESS, ".") || die "Create: $!";
This code creates an asychronous instance of
Notepad
. Let's take a look at the parameters. The first parameter The second argument is a fully qualified (system-dependent) path to the executable. The third argument is the command line passed to the program. In this case, we're just invoking Notepad without any documents or options. The next argument specifies whether or not the new process inherits handles from the parent process (the Perl program). A value of one indicates that the process inherits any inheritable open handle in the parent process. Inheritable handles include I/O handles, socket handles, synchronization handles, and so on. Unless you really know what you're doing here, you're better off specifying this value as zero.
The next argument specifies various create options for the new process. The flag that we've passed is |
|