perl Win32::Process 进程管理

perl Win32::Process 进程管理,第1张

概述NAME Win32::Process - Create and manipulate processes. SYNOPSIS       useWin32::Process;useWin32;subErrorReport{    printWin32::FormatMessage( Win32::GetLastError() );}Win32::Process::Cr name

Win32::Process - Create and manipulate processes.

SYnopSIS
          
  @H_404_30@    
useWin32::Process;useWin32;subErrorReport{    printWin32::FormatMessage( Win32::GetLastError() );}Win32::Process::Create($ProcessObj,                            "C:\\winnt\\system32\\notepad.exe",                            "notepad temp.txt",                            0,                            norMAL_PRIORITY_CLASS,                            ".")||dIEErrorReport();$ProcessObj->Suspend();$ProcessObj->Resume();$ProcessObj->Wait(INFINITE);
DESCRIPTION

This module provIDes access to the process control functions in the Win32 API.

METHODS Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)

Creates a new process.

                    
                              @H_404_30@                           
Args:    $objcontainerforprocess object    $appnamefull path name of executable module    $cmdlinecommand line args    $iflagsflag: inherit calling processes handles or not    $cflagsflagsforcreation (see exported vars below)    $curdirworking dir of new process

Returns non-zero on success,0 on failure.

Win32::Process::Open($obj,$pID,$iflags)

Creates a handle Perl can use to an existing process as IDentifIEd by $pID. The $iflags is the inherit flag that is passed to OpenProcess. Currently Win32::Process objects created using Win32::Process::Open cannot Suspend or Resume the process. All other calls should work.

Win32::Process::Open returns non-zero on success,0 on failure.

Win32::Process::KillProcess($pID,$exitcode)

Terminates any process IDentifIEd by $pID. $exitcode will be set to the exit code of the process.

$ProcessObj->Suspend()

Suspend the process associated with the $ProcessObj.

$ProcessObj->Resume()

Resume a suspended process.

$ProcessObj->Kill($exitcode)

Kill the associated process,have it terminate 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). Note that the ABOVE_norMAL_PRIORITY_CLASS and BELOW_norMAL_PRIORITY_CLASS classes only work on windows 2000 and later.

$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. Will return STILL_ACTIVE if the process is still running. The STILL_ACTIVE constant is only exported by explicit request.

$ProcessObj->Wait($timeout)

Wait for the process to dIE. $timeout should be specifIEd in milliseconds. To wait forever,specify the constant INFINITE.

$ProcessObj->GetProcessID()

Returns the Process ID.

Win32::Process::GetCurrentProcessID()

Returns the current process ID,which is the same as $$. But not on cygwin,where $$ is the cygwin-internal PID and not the windows PID. On cygwin GetCurrentProcessID() returns the windows PID as needed for all the Win32::Process functions.

EXPORTS

The following constants are exported by default:

          
@H_404_30@
CREATE_DEFAulT_ERROR_MODECREATE_NEW_CONSolECREATE_NEW_PROCESS_GROUPCREATE_NO_WINDOWCREATE_SEParaTE_WOW_VDMCREATE_SUSPENDEDCREATE_UNICODE_ENVIRONMENTDEBUG_ONLY_THIS_PROCESSDEBUG_PROCESSDETACHED_PROCESSHIGH_PRIORITY_CLASSIDLE_PRIORITY_CLASSINFINITEnorMAL_PRIORITY_CLASSREALTIME_PRIORITY_CLAsstHREAD_PRIORITY_ABOVE_norMALTHREAD_PRIORITY_BELOW_norMALTHREAD_PRIORITY_ERROR_RETURNTHREAD_PRIORITY_HIGHESTTHREAD_PRIORITY_IDLETHREAD_PRIORITY_LOWESTTHREAD_PRIORITY_norMALTHREAD_PRIORITY_TIME_CRITICAL

The following additional constants are exported by request only:

          
ABOVE_norMAL_PRIORITY_CLASSBELOW_norMAL_PRIORITY_CLASsstILL_ACTIVE
liCENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

总结

以上是内存溢出为你收集整理的perl Win32::Process 进程管理全部内容,希望文章能够帮你解决perl Win32::Process 进程管理所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1274302.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存