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



32
33
34
# File 'lib/win32/autogui/window.rb', line 32

def initialize(parent)
  @parent = parent
end

Instance Method Details

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

Yields:



38
39
40
41
42
43
44
45
# File 'lib/win32/autogui/window.rb', line 38

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.handle == @parent.handle)
  end
end