Yes, you can do this, fellow my script :
use Win32::API; Win32::API::Struct->typedef( RECT => qw{ LONG Left; LONG Top; LONG Right; LONG Bottom; }); Win32::API->Import("User32", "int GetDesktopWindow ()"); Win32::API->Import("User32", "int GetWindowRect ( int hWnd, LPRECT lpR +ect)"); my $h = GetDesktopWindow(); my $r = Win32::API::Struct->new('RECT'); GetWindowRect ( $h, $r ); print "Screen Resolution : ", $r->{Right} - $r->{Left}, ' x ', $r->{Bottom} - $r->{Top};
... or this code to enumerate all monitor. I didn't tested because I don't have host with more than one monitor >( !!
use Win32::API; use Win32::API::Callback; Win32::API::Struct->typedef( RECT => qw{ LONG Left; LONG Top; LONG Right; LONG Bottom; }); Win32::API::Struct->typedef( MONITORINFO => qw{ LONG cbSize; RECT rcMonitor; RECT rcWork; LONG dwFlags; }); Win32::API->Import('User32', 'EnumDisplayMonitors', 'NPKN', 'N'); Win32::API->Import('User32', 'int GetMonitorInfoA (int hMonitor, LPMON +ITORINFO lpmi)'); my $MonitorEnumProc = Win32::API::Callback->new( sub { my( $hMonitor, $hdcMonitor, $lprcMonitor, $dwData) = @_; my $MI = Win32::API::Struct->new('MONITORINFO'); my $R = Win32::API::Struct->new('RECT'); $MI->{cbSize} = 40; GetMonitorInfoA ($hMonitor, $MI); print "Monitor resolution : ", $MI->{rcMonitor}->{Right} - $MI->{rcMonitor}->{Left}, ' x +', $MI->{rcMonitor}->{Bottom} - $MI->{rcMonitor}->{Top}, "\n" +; return 1; }, "NNPN", "N", ); EnumDisplayMonitors ( 0x0, 0x0, $MonitorEnumProc, 0x0 );
Solli Moreira Honorio
Sao Paulo - Brazil

In reply to Re: Determine screen resolution (on Windows) by shonorio
in thread Determine screen resolution (on Windows) by mdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.