zli034 has asked for the wisdom of the Perl Monks concerning the following question:

This code defines a win32::ole object by using window title

use Win32::OLE;

my $main = new Win32::OLE 'WScript.Shell';

my $targetExactWindowName = ' Marketing - Microsoft Internet Explorer';

# This brings it to the foreground

$main->AppActivate( $targetExactWindowName );

How can I detect and close other existing windows except the defined win32::ole object?

Replies are listed 'Best First'.
Re: Win32::OLE close other windows
by wfsp (Abbot) on Oct 06, 2007 at 07:46 UTC
    Win32::GuiTest has a FindWindowLike method that takes a regex as an argument. This may well be able to do what you want.
Re: Win32::OLE close other windows
by Anonymous Monk on Oct 06, 2007 at 06:39 UTC
    write code to do it

      Tomorrow I'm going to try the win32::process::list to get all PIDs of running system, and terminated them individually.

      Should be OK