NAME

Win32::Process - Create and manipulate processes. версия для печати


SYNOPSIS use Win32::Process; use Win32;

        sub ErrorReport{
                print Win32::FormatMessage( Win32::GetLastError() );
        }

        Win32::Process::Create($ProcessObj,
                                "D:\\winnt35\\system32\\notepad.exe",
                                "notepad temp.txt",
                                0,
                                NORMAL_PRIORITY_CLASS,
                                ".")|| die ErrorReport();

        $ProcessObj->Suspend();
        $ProcessObj->Resume();
        $ProcessObj->Wait(INFINITE);


DESCRIPTION

This module allows for control of processes in Perl.


METHODS

Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)
Creates a new process.

    Args:

        $obj            container for process object
        $appname        full path name of executable module
        $cmdline        command line args
        $iflags         flag: inherit calling processes handles or not
        $cflags         flags for creation (see exported vars below)
        $curdir         working dir of new process

Win32::Process::KillProcess($pid, $exitcode)
Terminates any process identified by $pid. The process will exit with $exitcode.

$ProcessObj->Suspend()
Suspend the process associated with the $ProcessObj.

$ProcessObj->Resume()
Resume a suspended process.

$ProcessObj->Kill( $ExitCode )
Kill the associated process, have it die with exit code $ExitCode.

$ProcessObj->GetPriorityClass($class)
Get the priority class of the process.

$ProcessObj->SetPriorityClass( $class )
Set the priority class of the process (see exported values below for options).

$ProcessObj->GetProcessAffinitymask( $processAffinityMask, $systemAffinitymask)
Get the process affinity mask. This is a bitvector in which each bit represents the processors that a process is allowed to run on. .

$ProcessObj->SetProcessAffinitymask( $processAffinityMask )
Set the process affinity mask. Only available on Windows NT.

$ProcessObj->GetExitCode( $ExitCode )
Retrieve the exitcode of the process.

$ProcessObj->Wait($Timeout)
Wait for the process to die. forever = INFINITE

$ProcessObj->GetProcessID()
Returns the Process ID.


CHANGES (v. 0.061)

Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir,$wShowWindow,$Title)
Additional optional parameter $wShowWindow - one of SW_ flags (for more info look at <Win32\winuser.h> or Win32API docs). This is how child process window will be opened (normal, minimized, maximized).

The most useful flags are:

        SW_SHOWNORMAL
        SW_SHOWMINIMIZED
        SW_SHOWMAXIMIZED
        SW_SHOWNOACTIVATE

Another optional parameter $Title defines the title displayed in the title bar if a new console window is created (with CREATE_NEW_CONSOLE flag).

Additional constant STILL_ACTIVE
This value is exitcode set by

  $ProcessObj->GetExitCode($ExitCode);

when process is still active.

Changes by Mike Blazer <blazer@mail.nevalink.ru>