List Running Applications on Win32 (!Processes)

Discussion in 'Perl Misc' started by Francis Libble, Feb 17, 2004.

  1. Dear All

    Can someone tell me how to get a list of running applications on
    Win32?
    I am essentially looking to get the same list as appears in the
    Applications tab of the Windows Task Manager. I can easily get the
    equivalent of the Processes tab in Windows Task Manager (using
    Win32::Setupsup or Win32::IProc) but I can't seem to find a way to
    retrieve only the running applications.

    Enumerating Window titles doesn't give me what I am looking for either
    (hidden windows with titles show up)

    Thanks

    Flibble
    Francis Libble, Feb 17, 2004
    #1
    1. Advertising

  2. Francis Libble

    Sisyphus Guest

    Francis Libble wrote:
    > Dear All
    >
    > Can someone tell me how to get a list of running applications on
    > Win32?
    > I am essentially looking to get the same list as appears in the
    > Applications tab of the Windows Task Manager. I can easily get the
    > equivalent of the Processes tab in Windows Task Manager (using
    > Win32::Setupsup or Win32::IProc) but I can't seem to find a way to
    > retrieve only the running applications.
    >
    > Enumerating Window titles doesn't give me what I am looking for either
    > (hidden windows with titles show up)
    >


    Win32::perfLib (part of libwin) or Win32::process::Info (my preference).

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
    Sisyphus, Feb 17, 2004
    #2
    1. Advertising

  3. Francis Libble

    Sisyphus Guest

    Sisyphus wrote:

    >
    > Win32::perfLib (part of libwin) or Win32::process::Info (my preference).
    >


    Oops - now that I read your post properly I'm not sure that either of
    those modules supply what you want. Check them out, anyway :)

    Cheers,
    Rob


    --
    To reply by email u have to take out the u in kalinaubears.
    Sisyphus, Feb 17, 2004
    #3
  4. Francis Libble

    Petri Guest

    In article <>, Francis Libble
    says...
    > Can someone tell me how to get a list of running applications on
    > Win32?
    > I am essentially looking to get the same list as appears in the
    > Applications tab of the Windows Task Manager.


    Yes, I wonder where you'd get that information...
    It isn't available in any of the Win32_Process class properties anyway, I looked
    through them.
    There are some that sound good:
    ---8<---
    #!/usr/bin/perl -w
    use strict;
    use warnings;
    use Win32::OLE qw(in);

    my $wmi;
    eval {
    $wmi = Win32::OLE->GetObject("winmgmts:");
    };

    unless ($@) {
    my $proc_set;
    eval {
    $proc_set = $wmi->InstancesOf('Win32_Process');
    };
    die ("InstancesOf failed: ", Win32::OLE->LastError, "\n") if ($@);
    printf "%-6s%-20s%-20s%-20s\n", 'PID', 'Name', 'Caption', 'Description';
    printf "%-6s%-20s%-20s%-20s\n", '-' x 5, '-' x 19, '-' x 19, '-' x 19;
    foreach my $proc (in($proc_set)) {
    printf "%-6s%-20s%-20s%-20s\n", $proc->{'ProcessID'}, $proc->{'Name'},
    $proc->{'Caption'}, $proc->{'Description'};
    }
    } else {
    die "Win32::OLE->GetObject failed: ", Win32::OLE->LastError, "\n";
    }
    ---8<---

    But no... :)

    There is a utility in the Win2K Resource Kit called tlist.exe, which will print
    running processes by pid, name AND if available, the very string that you are
    looking for.
    You could use the output of that program to capture your data.

    It won't show threads of applications though, like iexplore.exe for example.
    If you start several iexplore.exe, they will all show.
    If you start one iexplore.exe, and press ctrl-n or right_click->"Open link in
    new window", the following windows will not show up, making the list shorter
    than in Task Manager.
    That's expected, tlist.exe lists processes by pid, not by thread.

    What do you need this for?
    Are you planning to do something with SendKeys? :)

    Hope this helps!

    Petri
    Petri, Feb 18, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Rodriguez
    Replies:
    23
    Views:
    1,090
    David Schwartz
    Dec 9, 2003
  2. Junkone

    list of win32 processes

    Junkone, Jan 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    106
  3. Marc Heiler
    Replies:
    1
    Views:
    165
    Robert Klemme
    May 24, 2009
  4. Ziv Tepman
    Replies:
    0
    Views:
    58
    Ziv Tepman
    Jan 21, 2014
  5. Ziv Tepman
    Replies:
    0
    Views:
    77
    Ziv Tepman
    Jan 21, 2014
Loading...

Share This Page