Window Capture Functions¶
- class autocv.core.window_capture.WindowCapture(hwnd: int = -1)[source]¶
A class for capturing images of windows on the desktop.
This class provides methods to obtain information about windows, capture images from specific windows, and list child windows for the current window. It interacts with the Windows API to manage window handles and capture screens.
- get_windows_with_hwnds() list[tuple[int, str]] [source]¶
Retrieves all visible windows with their handles and titles.
- Returns:
A list of tuples, where each tuple contains a window handle and its corresponding title.
- get_hwnd_by_title(title: str) int | None [source]¶
Finds the first visible window whose title contains the specified string.
- Parameters:
title – A substring to search for within window titles.
- Returns:
The window handle of the first matching window, or None if no match is found.
- get_child_windows() list[tuple[int, str]] [source]¶
Retrieves all child windows for the current window.
- Returns:
A list of tuples, where each tuple contains a child window handle and its class name.
- set_hwnd_by_title(title: str, *, case_insensitive: bool = False) bool [source]¶
Sets the current window handle based on a window title substring.
- Parameters:
title – A substring to search for within window titles.
case_insensitive – If True, the search will be case-insensitive. Defaults to False.
- Returns:
True if a matching window was found and the current window handle was updated; False otherwise.
- set_inner_hwnd_by_title(class_name: str) bool [source]¶
Sets the current window handle based on a child window’s class name substring.
- Parameters:
class_name – A substring to search for within child window class names.
- Returns:
True if a matching child window was found and the current window handle was updated; False otherwise.