OS2-WinObject
view release on metacpan or search on metacpan
WinObject.pm view on Meta::CPAN
=head1 NAME
OS2::WinObject - Perl extension for access the subset of C<Win*> API
for dealing with WPS objects.
=head1 SYNOPSIS
use OS2::WinObject ':all';
$desktop = QueryObject '<WP_DESKTOP>';
OpenObject $desktop, OPEN_SETTINGS, 1
or die "Can't open DESKTOP settings notebook: $!";
$w = SysValue 'CXSCREEN';
($x,$y,$w,$h,$fl,$b,$s) = WindowPos QueryDesktopWindow;
$p = ActiveDesktopPathname;
$p = ObjectPath $desktop;
=head1 DESCRIPTION
Most reasonable things to do with WPS objects require access via the SOM/DSOM
subsystem. However, C<Win*> API contains some (very primitive) means to deal
with objects via their I<handles>, delegating the actual work to WPS.
When choosing these functions, the principal target was completeness; many of
these function are useless except in extremely bizzare circumstances.
WinObject.pm view on Meta::CPAN
= WindowPos($hwnd) or die "Failure of WindowPos()";
ObjectClasses() returns a hash C<class =E<gt> DLLname>; $flags is a
combination of C<SWP_*> constants.
Note that the functions
LONG WinQuerySysValue(LONG iSysValue, HWND hwndDesktop {SANE DEFAULT})
BOOL WinSetSysValue (LONG iSysValue, LONG lValue, HWND hwndDesktop)
has the desktop argument at the last position, while the C counterparts
have it as the first argument (to enable the default value for the desktop).
The easier-to-use counterparts of these functions are
$value = SysValue($string);
SysValue_set($string, $value) or die "Cannot set: $^E";
here $string is one of
SWAPBUTTON DBLCLKTIME CXDBLCLK CYDBLCLK CXSIZEBORDER CYSIZEBORDER ALARM
CURSORRATE FIRSTSCROLLRATE SCROLLRATE NUMBEREDLISTS WARNINGFREQ NOTEFREQ
ERRORFREQ WARNINGDURATION NOTEDURATION ERRORDURATION CXSCREEN CYSCREEN
print "ok $test\n";
$test++;
$buf =~ s/\0.*//s or print "# \$!=$!\nnot ";
print "ok $test\n";
$test++;
$p eq $buf or print "#'$p' ne '$buf'\nnot ";
print "ok $test\n";
print "# path to desktop is '$buf'\n";
$test++;
$p1 = ActiveDesktopPathname() or print "# \$!=$!\nnot ";
print "ok $test\n";
$test++;
$p eq $p1 or print "#'$p' ne '$p1'\nnot ";
print "ok $test\n";
$test++;
$test++;
($x,$y,$w,$h,$fl,$b,$s) = WindowPos($dt) or print "# \$!=$!\nnot ";
print "ok $test\n";
$test++;
print "# (x $x, y $y, w $w, h $h, fl $fl, b $b, s $s) <- $dt => $$dt\n";
($w1, $h1) = map SysValue($_), qw( CXSCREEN CYSCREEN ) or print "# \$!=$!\nnot ";
print "ok $test\n";
warn "# unexpected sizes (x $x, y $y, w $w, h $h) of desktop\n"
unless $x == 0 and $y == 0 and $w == $w1 and $h == $h1;
( run in 0.344 second using v1.01-cache-2.11-cpan-299005ec8e3 )