Class: Win32::CaptureIE::Window
- Inherits:
-
Object
- Object
- Win32::CaptureIE::Window
- Includes:
- FFI::User32
- Defined in:
- lib/win32/capture_ie/window.rb
Direct Known Subclasses
Constant Summary
Constants included from FFI::User32
FFI::User32::GW_HWNDFIRST, FFI::User32::GW_HWNDLAST, FFI::User32::GW_HWNDNEXT, FFI::User32::GW_HWNDPREV
Instance Attribute Summary collapse
-
#hwnd ⇒ Object
readonly
Returns the value of attribute hwnd.
Instance Method Summary collapse
- #bring_window_to_top(timeout = 5, wait = 0.5) ⇒ Object
- #find_child_window_by_classname(window, classname) ⇒ Object
-
#initialize(hwnd) ⇒ Window
constructor
A new instance of Window.
- #list_child_window(hwnd) ⇒ Object
- #wait_for_redraw(dt = 1) ⇒ Object
Methods included from FFI::User32
each_child_window, get_class_name, get_first_child, get_first_sibling, get_last_sibling, get_next_sibling, get_prev_sibling, get_top_window, get_window, get_window_rect, with_window_dc
Methods included from FFI::Base
Constructor Details
#initialize(hwnd) ⇒ Window
Returns a new instance of Window.
12 13 14 |
# File 'lib/win32/capture_ie/window.rb', line 12 def initialize(hwnd) @hwnd = hwnd end |
Instance Attribute Details
#hwnd ⇒ Object (readonly)
Returns the value of attribute hwnd.
10 11 12 |
# File 'lib/win32/capture_ie/window.rb', line 10 def hwnd @hwnd end |
Instance Method Details
#bring_window_to_top(timeout = 5, wait = 0.5) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/win32/capture_ie/window.rb', line 16 def bring_window_to_top(timeout=5, wait=0.5) return if GetForegroundWindow() == hwnd timeout(timeout) { while GetForegroundWindow() != hwnd CloseWindow(hwnd) OpenIcon(hwnd) BringWindowToTop(hwnd) sleep(wait) end } wait_for_redraw end |
#find_child_window_by_classname(window, classname) ⇒ Object
41 42 43 44 |
# File 'lib/win32/capture_ie/window.rb', line 41 def find_child_window_by_classname(window, classname) w = list_child_window(window).flatten w.find{|e| get_class_name(e) == classname } end |
#list_child_window(hwnd) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/win32/capture_ie/window.rb', line 33 def list_child_window(hwnd) r = [hwnd] each_child_window(hwnd) {|child| r << list_child_window(child) } r end |
#wait_for_redraw(dt = 1) ⇒ Object
29 30 31 |
# File 'lib/win32/capture_ie/window.rb', line 29 def wait_for_redraw(dt=1) sleep(dt) end |