Usable screen coordinates

View: New views
3 Messages — Rating Filter:   Alert me  

Usable screen coordinates

by Roode, Eric :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have the taskbar docked along the left side of the desktop.  When I
start Win32::GUI programs that do not explicitly position their main
window, the main window generally starts way over on the left side of
the screen, obscured by the taskbar.  I then have to move it to the
right in order to use it.  This seems clunky and unfriendly.  I have
also noticed that many programs (perl or not) do not behave nicely when
the taskbar is at the bottom of the screen and is more than one row
tall.

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?

Thanks,
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@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Parent Message unknown Re: Usable screen coordinates

by Roode, Eric :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 > 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@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Re: Usable screen coordinates

by Sean Healy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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

My guess is that it's simply not one of the constants included because
the function it's intended for is not yet ported to Win32::GUI.

> Thanks for pointing me in the right direction, Sean.

Glad I could help.


-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/
LightInTheBox - Buy quality products at wholesale price