[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting Screen Resolution in Windows with Ruby

Felipe Navas

12/26/2006 5:47:00 PM

Hi, somebody knows how i can get Screen Resolution in Windows with Ruby ?
Anything stable please! And WinXp, Win98, Win95 compatible.

Cheers

--
(.) CAMPANHA DA FITA ASCII ( http://ar...)
/ \ Contra formatos proprietarios

2 Answers

Wilson Bilkovich

12/26/2006 6:10:00 PM

0

On 12/26/06, Felipe Navas <felipenavas@gmail.com> wrote:
> Hi, somebody knows how i can get Screen Resolution in Windows with Ruby ?
> Anything stable please! And WinXp, Win98, Win95 compatible.
>

You can use the WIN32OLE library (or similar) to call the
GetSystemMetrics() function:
http://support.microsoft.com...

Felipe Navas

12/26/2006 6:50:00 PM

0

Thanks Wilson!

require 'dl/import'
require 'dl/struct'

SM_CXSCREEN = 0
SM_CYSCREEN = 1

user32 = DL.dlopen("user32")

get_system_metrics = user32['GetSystemMetrics', 'ILI']
x, tmp = get_system_metrics.call(SM_CXSCREEN,0)
y, tmp = get_system_metrics.call(SM_CYSCREEN,0)

puts "#{x} x #{y}"

On 12/26/06, Wilson Bilkovich <wilsonb@gmail.com> wrote:
> On 12/26/06, Felipe Navas <felipenavas@gmail.com> wrote:
> > Hi, somebody knows how i can get Screen Resolution in Windows with Ruby ?
> > Anything stable please! And WinXp, Win98, Win95 compatible.
> >
>
> You can use the WIN32OLE library (or similar) to call the
> GetSystemMetrics() function:
> http://support.microsoft.com...
>
>


--
(.) CAMPANHA DA FITA ASCII ( http://ar...)
/ \ Contra formatos proprietarios