From: Phil Smy Date: 2009-05-07T17:57:21+09:00 Subject: Re: calling winapi for EnumDisplayMonitors Hi Park, In short - you rule! Thanks - this does exactly what we need. I guess I need to do some reading up on win32-api to understand HOW it does it, but this is a great start. Much appreciated. Heesob Park wrote: > Here is a win32-api sample: > > require 'win32/api' > > EnumDisplayMonitors = Win32::API.new('EnumDisplayMonitors', 'LPKL', > 'B', 'user32') > GetMonitorInfo = Win32::API.new('GetMonitorInfo', 'LP', 'B', 'user32') > > MyInfoEnumProc = Win32::API::Callback.new('LLPL','L') { > |hMonitor,hdcMonitor,lprcMonitor,dwData| > lpmi = [72].pack('L') + 0.chr * 68 > GetMonitorInfo.call(hMonitor,lpmi) > info = lpmi.unpack('L10Z*') > puts "Name:#{info[10]}, Width:#{info[3]}, Height:#{info[4]} " > 1 > } > > EnumDisplayMonitors.call(0, nil, MyInfoEnumProc, 0) > > > Regards, > Park Heesob -- Posted via http://www.ruby-forum.com/.