# Re: wxRuby and getting the display size

**URL:** <https://www.ruby-forum.com/t/re-wxruby-and-getting-the-display-size/97957>\
**Category:** Ruby\
**Created:** [July 11, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/re-wxruby-and-getting-the-display-size/97957 "2006-07-11T17:28:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamal86](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jamal86](https://www.ruby-forum.com/u/jamal86)\
**Post date:** [July 11, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/re-wxruby-and-getting-the-display-size/97957/1 "2006-07-11T17:28:38Z")

</div>

I just wrote and tested the code below. It gets the coordinates of the  
Windows desktop area (screen not including taskbar) via a Windows API  
call.

Jamal

require ‘Win32API’

def get\_desktop\_area()  
function = Win32API.new(‘user32.dll’, ‘SystemParametersInfoA’, [‘L’,  
‘L’, ‘P’], ‘L’)  
spi\_getworkarea = 48  
structure = ’ ’ \* 4  
function.Call(spi\_getworkarea, 0, structure)  
left, top, right, bottom = structure.unpack(‘L4’)  
end

puts get\_desktop\_area
