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

Re: Determine screen resolution (on Windows)

by shonorio (Hermit)
on Jul 12, 2006 at 18:05 UTC ( #560768=note: print w/replies, xml ) Need Help??

in reply to Determine screen resolution (on Windows)

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://560768]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2023-01-27 14:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found