Win32-GuiTest
view release on metacpan or search on metacpan
Selects an item in the list view based off an index (zero-based).
# Select first item, clears out any previous selections.
SelListViewItem($win, 0);
# Select an *additional* item.
SelListViewItem($win, 1, 1);
SelListViewItemText($window, $txt, [$multi_select])
Selects an item in the list view based off text (case insensitive).
# Select first item, clears out any previous selections.
SelListViewItemText($win, 'Temp');
# Select an *additional* item.
SelListViewItemText($win, 'cabs', 1);
IsListViewItemSel($window, $txt)
Determines if the specified list view item is selected.
GetTabItems($window)
Returns a list of a tab control's labels.
SelTabItem($window, $idx)
Selects a tab based off an index (zero-based).
SelTabItemText($window, $txt)
Selects a tab based off text label (case insensitive).
IsTabItemSel($window, $txt)
Determines if the specified tab item is selected.
SelTreeViewItemPath($window, $path)
Selects a tree view item based off a "path" (case insensitive).
# Select Machine item and Processors sub-item.
SelTreeViewItemPath($window, "Machine|Processors");
SelTreeViewItemPath($window, "Item");
GetTreeViewSelPath($window)
Returns a string containing the path (i.e., "parent|child") of
the currently selected tree view item.
$oldpath = GetTreeViewSelPath($window);
SelTreeViewItemPath($window, "Parent|Child");
SelTreeViewItemPath($window, $oldpath);
$hpopup = GetPopupHandle($hwnd, $x, $y, [$wait])
This function gets the handle of a popup window generated by
right-clicking at the $x and $y screen coordinates (absolute). An
optional delay can be entered which will wait the given number of
milliseconds after the right-click for the window to appear (default
is 50). Zero is returned when no popup menu is found.
DibSect
A class to manage a Windows DIB section. Currently limited in
functionality to 24-bit images. Pulled from old code into GuiTest when I
(jurasz@imb.uni-karlsruhe.de) needed to create several grayscale screen
dumps.
Possible future extenstions: other color resolutions, loading,
comparison of bitmaps, getting from clipboard.
Synopsis:
$ds = new Win32::GuiTest::DibSect;
$ds->CopyWindow($w);
$ds->ToGrayScale();
$ds->SaveAs("bla.bmp");
$ds->ToClipboard();
bool DibSect::CopyClient(hwnd,[rect])
Copy a client area of given window (or possibly its subset) into
a given DibSect. The rectangle may be optionally passed as a
reference to 4-element array. To get the right result make sure
the window you want to copy is not obscured by others.
bool DibSect::CopyWindow(hwnd)
Copy the window rectangle. Equivalent to
$ds->CopyClient(GetDesktopWindow(), \@{[GetWindowRect($w)]});
bool DibSect::SaveAs(szFile)
Save the current contents of the DIB section in a given file.
With 24-bit resolution it can grow quite big, so I immediately
convert them to PNG (direct writing of PNG seemed to complicated
to implement).
bool DibSect::Invert()
Invert the colors in a current DIB section.
bool DibSect::ToGrayScale()
Convert the DibSection to the gray scale. Note that it is still
encoded as 24-bit BMP for simplicity.
bool DibSect::ToClipboard()
Copies the DibSect to clipboard (as an old-fashioned metafile),
so that it can be further processed with your favourite image
processing software, for example automatically using SendKeys.
bool DibSect::Destroy()
Destroys the contents of the DIB section.
UNICODE SUPPORT
Currently (2007) there's no consensus about unicode input in Perl, so
the module declares function "UnicodeSemantics" that sets whether
information queried from windows should use A or W syscalls. The
function that support this differentiation, and produce different
results depending on value set to "UnicodeSemantics" is:
"GetWindowText", and all its callers, - FindWindowLike, WaitWindow,
WaitWindowLike
"SendKeys" translated unicode characters into set of ALT+NUMPAD
keystrokes. Note that not all applications can understand unicode input.
UnicodeSemantics [BOOL]
If a boolean parameter is set, changes the semantics flag for
functions that return results of either A or W syscalls. If the
parameter is not set, returns the current value of the flag.
DEVELOPMENT
If you would like to participate in the development of this module there
are several thing that need to be done. For some of them you only need
Perl and the latest source of the module from CVS for others you'll also
need to have a C++ compiler.
To get the latest source code you need a CVS client and then do the
following:
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/winguitest login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/winguitest co Win32-GuiTest
See more detailed explanations here
http://sourceforge.net/projects/winguitest/
cygwin
g++ needs to be installed
perl Makefile.PL
make
make test
make install
MSVC environment
To setup a development environment for compiling the C++ code you can
either buy Visual Studio with Visual C++ or you can download a few
things free of charge from Microsoft. There might be other ways too we
have not explored.
The instructions to get the free environment are here:
From http://www.microsoft.com/ download and install:
1) Microsoft .NET Framework Version 1.1 Redistributable Package
2) .NET Framework SDK Version 1.1
( run in 1.453 second using v1.01-cache-2.11-cpan-81fc1098f69 )