> On 17 July 2008, Sean Healy wrote:
> [Eric Roode wrote:]
> > 
> > How can I start my programs at the leftmost part of the usable
desktop?
> > How can I ensure that my programs behave sanely with respect to
users'
> > taskbar configuration?
> 
> MSDN lists a function called SystemParametersInfo(), but it doesn't
> seem to be available yet in Win32::GUI. (Does anyone know
> differently?)
> 
> If it's really important to you, you can look up this function at
> www.msdn.com and then try Win32::API. You will probably also need to
> search online for winuser.h to find the values for the constants you
> want.
> 
> I've done this before to get functions that Win32::GUI doesn't yet
> provide. (In particular, I wrote something to determine the default
> icon for a file type and extract it so it could be used in a
> listview.) It can be time-consuming, but if you really want it, it's
> usually possible with Win32::API.

Thanks, Sean, this did work for me.  I found that you can pass
SPI_GETWORKAREA to SystemParametersInfo, to get a Rect that contains
the coordinates of the usable desktop area.

For some reason, I could not load SPI_GETWORKAREA via
Win32::GUI::Constants.
I don't know why.  The numeric value of SPI_GETWORKAREA is 48. So
here is the code I came up with:
================
use Win32::GUI();
use Win32::API;

Win32::API::Struct->typedef(RECT => qw{LONG x; LONG y; LONG w; LONG
h;});
my $rect = Win32::API::Struct->new('RECT');

my $spi = Win32::API->new(
                          'user32',
                          'BOOL SystemParametersInfo(UINT uiAction,
                           UINT uiParam, LPRECT pvParam, UINT fWinIni)'
                         );
$spi->Call(48, 0, $rect, 0);

say "(x,y)=($rect->{x},$rect->{y}); (w,h)=($rect->{w},$rect->{h})";
================

Thanks for pointing me in the right direction, Sean.

--
Eric

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to