in reply to Re: Re: Suspending a process (slighty OT)
in thread Suspending a process (slighty OT)

I could be wrong, but I think that the Suspend and Resume methods only work on objects created by Win32::Process::Create().

Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;
  • Comment on Re: Re: Re: Suspending a process (slighty OT)

Replies are listed 'Best First'.
Re: Re: Re: Re: Suspending a process (slighty OT)
by John M. Dlugosz (Monsignor) on Sep 24, 2001 at 10:31 UTC
    It will work on anything regardless of how it was created, IF you can obtain a kernel handle to the process with suitable rights. Using the Win32 function to directly create a process is handy because that's what it returns (via the process information structure "out" parameter).

    There is a function, OpenProcess, that will give you a handle from the global "process identifier".

    Having separate handles and ID's is why Win32 doesn't have zombies.

    —John

      I know you can suspend and resume processes not created with the Win32::Process module. I've done it in the past using WMI. I can't see any OpenProcess method with the Win32::Process module, and I get this error if I try ant use it:
      Your vendor has not defined Win32::Process macro OpenProcess
      Update: it looks like OpenProcess() is a Win32 API and isn't implimented in Win32::Process. So my original statement stands - the Suspend() and Resume() methods will work only on processes created with Win32::Process::Create(). If you want to suspend a process that isn't create with that module, then you'll have to use WMI or the Win32 API.

      Simon Flack ($code or die)
      $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
      =~y'_"' ';eval"die";print $_,lc substr$@,0,3;