Sha256: 84fc03ffa40e16ce681324e25eb8871add15f8c4c3b0dd5b8fe27b56b8611a28
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module Win32 class Screenshot class Util class << self def all_windows titles = [] window_callback = FFI::Function.new(:bool, [ :long, :pointer ], { :convention => :stdcall }) do |hwnd, param| titles << [window_title(hwnd), hwnd] true end BitmapMaker.enum_windows(window_callback, nil) titles end def window_title hwnd title_length = BitmapMaker.window_text_length(hwnd) + 1 title = FFI::MemoryPointer.new :char, title_length BitmapMaker.window_text(hwnd, title, title_length) title.read_string end def window_hwnd(title_query) hwnd = BitmapMaker.hwnd(title_query) raise "window with title '#{title_query}' was not found!" unless hwnd hwnd end def dimensions_for(hwnd) rect = [0, 0, 0, 0].pack('L4') BitmapMaker.client_rect(hwnd, rect) _, _, width, height = rect.unpack('L4') return width, height end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
win32screenshot-0.0.7 | lib/win32/util.rb |