Window Capture Functions

class autocv.core.window_capture.WindowCapture(hwnd: int = -1)[source]

Capture metadata and child handles for a Windows GUI window.

hwnd

Handle for the window currently targeted by the instance.

Type:

int

get_windows_with_hwnds() list[tuple[int, str]][source]

Return all visible windows exposed by EnumWindows.

Returns:

(handle, title) pairs for visible windows.

Return type:

list[tuple[int, str]]

get_hwnd_by_title(title: str) int | None[source]

Find the first window whose title contains title.

Parameters:

title (str) – Substring to match against window titles.

Returns:

Matching window handle or None if no window matches.

Return type:

int | None

get_child_windows() list[tuple[int, str]][source]

Return child windows for the current hwnd.

Returns:

(handle, class_name) pairs for child windows.

Return type:

list[tuple[int, str]]

set_hwnd_by_title(title: str, *, case_insensitive: bool = False) bool[source]

Update hwnd when a matching window title is discovered.

Parameters:
  • title (str) – Substring searched for within window titles.

  • case_insensitive (bool) – If True, perform a case-insensitive comparison. Defaults to False.

Returns:

True when a matching window is found, otherwise False.

Return type:

bool

set_inner_hwnd_by_title(class_name: str) bool[source]

Update hwnd to the first child window whose class matches.

Parameters:

class_name (str) – Substring searched for within child window class names.

Returns:

True when a matching child window is found, otherwise False.

Return type:

bool