Win32::FindWindow - find windows on Win32 systems |
Win32::FindWindow - find windows on Win32 systems
use Win32::FindWindow qw/find_window find_windows/; $window = find_window(); $window = find_window( classname => 'ExploreWClass' ); $window = find_window( basename => qr/^Explorer.EXE$/ , filename => qr/^C:\\WINDOWS\\.*/ , windowtext => qr/^C:\\$/ , classname => qr/^ExploreWClass$/ ); @windows = find_windows(); @windows = find_windows( windowtext => qr/ - Microsoft Internet Explorer$/ ); @windows = find_windows( basename => 'mspaint.exe' , filename => 'C:\\WINDOWS\\system32\\mspaint.exe' , windowtext => qr/^.+$/ , classname => 'MSPaintApp' ); $window->basename; $window->filename; $window->windowtext; $window->classname; $window->hwnd; $window->pid;
This module provides routines for finding windows on Win32 systems.
find_window()
Win32::FindWindow
objects by supplied search parameters.
The parameters are as follows:
basename filename windowtext classname hwnd pid
SCALAR
or Regexp
value can be specified as search conditions for finding window.
Like this:
$window = find_window( basename => 'wmplayer.exe' ); $window = find_window( windowtext => qr/^Windows Media/ );
find_windows()
find_window()
except it returns multiple objects as ARRAY
.
@windows = find_windows( basename => 'mspaint.exe' , filename => 'C:\\WINDOWS\\system32\\mspaint.exe' , windowtext => qr/^.+$/ , classname => 'MSPaintApp' );
$window = find_window( ... ); # accessors (read-only) $window->basename; $window->filename; $window->windowtext; $window->classname; $window->hwnd; $window->pid;
Accessor methods is being offered as shown in the above. These are read-only.
# how to use regexp with wide characters # e.g. pattern matching the character that starts by Japanese `スタート' use Win32::FindWindow qw/find_windows/; use utf8; use encoding 'utf8', STDOUT => 'cp932'; $Win32::FindWindow::ENCODING = 'cp932'; @windows = find_windows( classname => 'Button' , windowtext => qr/^スタート/ );
A string value that shows system encodings. Defaults to 'cp1252'.
Set your system's codepage string that module Encode
supported.
Because this module uses Encode::decode()
internally.
GetClassName()
, EnumProcessModules()
, GetModuleFileNameEx()
and GetModuleBaseName()
.
the Win32::API manpage, the Win32::API::Callback manpage, the Class::Accessor::Fast manpage, the Encode manpage, How To Enumerate Windows Using the WIN32 API: http://support.microsoft.com/kb/183009
Michiya Honda <pia@cpan.org>
This library is free software, licensed under the same terms with Perl. See the perlartistic manpage.
Win32::FindWindow - find windows on Win32 systems |