Show / Hide Table of Contents

Method wnd.Child(+ 1 overload)


Overload

Finds a child control and returns its handle as wnd.

public wnd Child(string name = null, string cn = null, WCFlags flags = 0, int? id = null, Func<wnd, bool> also = null, int skip = 0)
Parameters
name  (string)

Control name. String format: wildcard expression. null means "can be any". "" means "no name".

By default to get control names this function uses wnd.Name. Can start with these prefix strings:

  • "***text " - use wnd.ControlText. Slower and less reliable because can get editable text. If a character can be underlined with Alt, insert '&' before it.
  • "***elmName " - use wnd.NameElm. Slower.
  • "***wfName " - use .NET Forms control name (see WinformsControlNames). Slower and can fail because of UAC.
cn  (string)

Control class name. String format: wildcard expression. null means "can be any". Cannot be "".

flags  (WCFlags)
id  (int?)

Control id. See wnd.ControlId. Not used if null (default).

also  (Func<wnd, bool>)

Callback function. Called for each matching control. It can evaluate more properties of the control and return true when they match. Example: also: t => t.IsEnabled

skip  (int)

0-based index of matching control. For example, if 1, the function skips the first matching control and returns the second.

Returns
wnd

Returns default(wnd) if not found. See also: wnd.Is0.

Exceptions
AuWndException

This variable is invalid (window not found, closed, etc).

ArgumentException
  • name starts with "***", but the prefix is invalid.
  • cn is "". To match any, use null.
  • Invalid wildcard expression ("**options " or regular expression).

Remarks

To create code for this function, use tool Find window.


Overload(top)

Finds a child control and returns its handle as wnd. Can wait and throw NotFoundException.

public wnd Child(Seconds wait, string name = null, string cn = null, WCFlags flags = 0, int? id = null, Func<wnd, bool> also = null, int skip = 0)
Parameters
wait  (Seconds)

The wait timeout, seconds. If 0, does not wait. If negative, does not throw exception when not found.

name  (string)

Control name. String format: wildcard expression. null means "can be any". "" means "no name".

By default to get control names this function uses wnd.Name. Can start with these prefix strings:

  • "***text " - use wnd.ControlText. Slower and less reliable because can get editable text. If a character can be underlined with Alt, insert '&' before it.
  • "***elmName " - use wnd.NameElm. Slower.
  • "***wfName " - use .NET Forms control name (see WinformsControlNames). Slower and can fail because of UAC.
cn  (string)

Control class name. String format: wildcard expression. null means "can be any". Cannot be "".

flags  (WCFlags)
id  (int?)

Control id. See wnd.ControlId. Not used if null (default).

also  (Func<wnd, bool>)

Callback function. Called for each matching control. It can evaluate more properties of the control and return true when they match. Example: also: t => t.IsEnabled

skip  (int)

0-based index of matching control. For example, if 1, the function skips the first matching control and returns the second.

Returns
wnd

Child control handle. If not found, throws exception or returns default(wnd) (if wait negative).

Exceptions
AuWndException

This variable is invalid (window not found, closed, etc). Or closed while waiting.

NotFoundException
ArgumentException
  • name starts with "***", but the prefix is invalid.
  • cn is "". To match any, use null.
  • Invalid wildcard expression ("**options " or regular expression).

Remarks

To create code for this function, use tool Find window.