Class: Autogui::Children

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Windows::Window
Defined in:
lib/win32/autogui/window.rb

Overview

Enumerate just the child windows one level down from the parent window

Constant Summary

Constants included from Windows::Window

Windows::Window::SC_CLOSE

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Children

Returns a new instance of Children.

Parameters:

  • parent (Number)

    window handle



64
65
66
# File 'lib/win32/autogui/window.rb', line 64

def initialize(parent)
  @parent = parent
end

Instance Method Details

#each {|Window| ... } ⇒ Object

Yields:



70
71
72
73
74
75
76
77
# File 'lib/win32/autogui/window.rb', line 70

def each
  child_after = 0
  while (child_after = FindWindowEx(@parent.handle, child_after, nil, nil)) > 0 do
    window = Window.new child_after
    # immediate children only
    yield window if (window.parent) && (window.parent.handle == @parent.handle)
  end
end