Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
The stupid question is the question not asked
 
PerlMonks  

How to get screen resolution under Win32?

by Anonymous Monk
on Sep 25, 2001 at 03:17 UTC ( #114444=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

how can i get the screen resolution of a user's computer on a win32 system?

Comment on How to get screen resolution under Win32?
Re: win32 help...
by CubicSpline (Friar) on Sep 25, 2001 at 04:06 UTC
    Look into the Win32-API module which allows you access to the windows registry. From there, look at HKEY_LOCAL_MACHINE\Config\0001\Display\Settings\Resolution.

    I may get down-voted for answering this, but it isn't exactly obvious and maybe someone else could benefit.

      Maybe it varies between Win32 OS's, because I see nothing remotely like that. No Config key under HKLM, and no Resolution key or named value with this information anywhere in the Registry.

      This is Windows 2000.

      —John

        Yes. HKLM isn't really used by MS on Win2k. I'm not sure, but I don't think XP uses it at all.
Re: win32 help...
by $code or die (Deacon) on Sep 25, 2001 at 04:32 UTC
    Check out Aldo Calpini's chres.pl. It gets\sets the screen settings.

    You probably already know this, but this method will not work in a CGI environment - i.e. you can't get the resolution of a remote user's screen via a webpage without a client-side script such as javascript. But I'm the wrong person to ask about that :)

    Update: Aldo's site appears to have changed since I was last there - and I can't find anything related to perl. The above URL is the same one listed for him on CPAN. ?

    Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
      A simple Google...

      You can download Aldo's chres.pl script here.

        My link to chres.pl is ok - it's the link to Aldo's site that is the problem. :)

        And yes, I tried google for that too - the url is ok, it's the same one I've used many times - but his site is gone and without trace!

        Simon Flack ($code or die)
        $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
        =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
Re: How to get screen resolution under Win32?
by EvanK (Chaplain) on Sep 26, 2001 at 10:11 UTC
    $DesktopWin = $Main->GetDesktopWindow(); (undef,undef,$DesktopWidth,$DesktopHeight) = Win32::GUI::GetWindowRect +($DesktopWin); print "Screen Resolution is $DesktopWidth x $DesktopHeight";
    note: this requires use of the win32::gui module

    ______________________________________________
    RIP
    Douglas Noel Adams
    1952 - 2001

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://114444]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-04-25 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (586 votes), past polls