Win32::Process Kill Process in Windows ME - Perl

This is a discussion on Win32::Process Kill Process in Windows ME - Perl ; Hello, I want to kill a Process in Windows ME, which I have started. I have executed the following lines in XP and it works. I execute this in ME, the process starts but it won't be killed. Win32::Process::Create($ProcessObj, "C:\\Program ...

+ Reply to Thread
Results 1 to 4 of 4

Win32::Process Kill Process in Windows ME

  1. Default Win32::Process Kill Process in Windows ME

    Hello,

    I want to kill a Process in Windows ME, which I have started. I have
    executed the following lines in XP and it works. I execute this in ME,
    the process starts but it won't be killed.

    Win32::Process::Create($ProcessObj,
    "C:\\Program Files\\Internet
    Explorer\\iexplorer.exe",
    "iexplore temp.txt",
    0,
    NORMAL_PRIORITY_CLASS,
    ".")|| die ErrorReport();

    $ProcessObj->Kill(1);

    Is there a possibility to kill processes in Windows ME?

    Thanks in advance.

    Stefan

  2. Default Re: Win32::Process Kill Process in Windows ME


    "Stefan Mueller" <s1210197@yahoo.de> wrote in message
    news:f35b4d73.0504122349.79560db0@posting.google.com...
    > Hello,
    >
    > I want to kill a Process in Windows ME, which I have started. I have
    > executed the following lines in XP and it works. I execute this in ME,
    > the process starts but it won't be killed.
    >


    What actually happens ? Does the script hang .... or exit silently .... or
    ..... ?
    Do you get any warnings or error messages ?

    use warnings;

    > Win32::Process::Create($ProcessObj,
    > "C:\\Program Files\\Internet
    > Explorer\\iexplorer.exe",
    > "iexplore temp.txt",
    > 0,
    > NORMAL_PRIORITY_CLASS,
    > ".")|| die ErrorReport();
    >


    Not sure. Maybe (untested):

    my $exitcode;
    my $pid = $ProcessObj->GetProcessID();
    Win32::Process::KillProcess($pid, $exitcode);
    # $exitcode is set to the exitcode of the process.

    Cheers,
    Rob

    --
    To reply by email send to optusnet.com.au instead of nomail.afraid.org



  3. Default Re: Win32::Process Kill Process in Windows ME

    Hello Rob,

    Thank you for your answer.

    "Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message news:<425ce4a5$0$29868$afc38c87@news.optusnet.com.au>...
    > What actually happens ? Does the script hang .... or exit silently .... or
    > .... ?
    > Do you get any warnings or error messages ?


    No, I get no error messages. The script doesn't hang, it exists like
    the way on XP.

    > use warnings;


    no warnings

    > Not sure. Maybe (untested):
    >
    > my $exitcode;
    > my $pid = $ProcessObj->GetProcessID();
    > Win32::Process::KillProcess($pid, $exitcode);
    > # $exitcode is set to the exitcode of the process.


    it's the same. What's about the exitcode? I have used 1 and 9, but
    there is no difference.

    Cheers,
    Stefan

  4. Default Re: Win32::Process Kill Process in Windows ME


    "Stefan Mueller" <s1210197@yahoo.de> wrote in message
    news:f35b4d73.0504142300.553dc396@posting.google.com...
    > Hello Rob,
    >
    > Thank you for your answer.
    >
    > "Sisyphus" <sisyphus1@nomail.afraid.org> wrote in message

    news:<425ce4a5$0$29868$afc38c87@news.optusnet.com.au>...
    > > What actually happens ? Does the script hang .... or exit silently ....

    or
    > > .... ?
    > > Do you get any warnings or error messages ?

    >
    > No, I get no error messages. The script doesn't hang, it exists like
    > the way on XP.
    >


    I can't find any documented reason for the problem (and I don't actually
    have a Windows ME to experiment with). KillProcess() calls OpenProcess() and
    TerminateProcess(). I've checked the msdn docs for both OpenProcess and
    TerminateProcess and there's no mention of any special considerations
    regarding Windows ME.

    If you want (and assuming you can compile Win32::Process from source) you
    could try changing (in Process.xs):
    HANDLE ph = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
    to:
    HANDLE ph = OpenProcess(PROCESS_TERMINATE, 0, pid);

    (You'll find that about 5 or 6 lines from the end of the file.) I can't
    really think of any reason that should help, however.

    ActiveState now hosts a (low volume) libwin32-perl mailing list. Maybe
    someone there can help. See:
    http://aspn.activestate.com/ASPN/Mail/

    Cheers,
    Rob







+ Reply to Thread

Similar Threads

  1. Re: howto kill a windows process by name ?
    By Application Development in forum Python
    Replies: 0
    Last Post: 10-05-2007, 06:30 PM
  2. Replies: 0
    Last Post: 10-02-2007, 01:00 AM
  3. Replies: 1
    Last Post: 04-17-2006, 04:11 PM
  4. Start process and kill process in Windows
    By Application Development in forum REXX
    Replies: 13
    Last Post: 11-01-2005, 08:50 AM
  5. Kill win32 process
    By Application Development in forum Perl
    Replies: 0
    Last Post: 01-07-2004, 11:10 AM