> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Foo Ji-Haw
> Sent: Tuesday, January 24, 2006 22:18
> To: [email protected]
> Subject: Retrieving Windows applications on desktop
> 
> Hello all,
> 
> This is a longshot, but I'm just gonna put it out and see 
> what I get...
> 
> Is there a way in Perl to get a list of all the Windows applications 
> that are running? Basically applications that show in the 
> Alt-Tab list. 
> I am just wondering if I can get the desktop coordinates of the 
> respective windows applications.
> 
> Any hint is appreciated.

Something like this may be a start, although I cannot help you with
obtaining desktop/window coordinates.

use Win32::OLE qw(in);
use Win32::OLE::Variant;
my $WMI = Win32::OLE->GetObject($CLASS) || die('WMI instantiation
failed');
# Find all PIDs, program-names, and executable paths for all running
processes.
for my $Process (sort{lc($a->{Name}) cmp lc($b->{Name})} in
($WMI->InstancesOf("Win32_Process")))
{
    $Name = $Process->{Name};           # Process program-name.
    $Path = $Process->{ExecutablePath}; # Process executable path.
    $PID  = $Process->{ProcessID};      # PID.
    $Path = '' unless (defined($Path));
}

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop 

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to