MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / __init__

Method __init__

source/binding/Python/maa/controller.py:858–887  ·  view source on GitHub ↗

创建 Win32 控制器 / Create Win32 controller Args: hWnd: 窗口句柄 / window handle screencap_method: 使用的截图方式 / screenshot method used mouse_method: 使用的鼠标输入方式 / mouse input method used keyboard_method: 使用的键盘输入方式 / keyboard input method used Raise

(
        self,
        hWnd: Union[ctypes.c_void_p, int, None],
        screencap_method: int = MaaWin32ScreencapMethodEnum.Background,
        mouse_method: int = MaaWin32InputMethodEnum.Seize,
        keyboard_method: int = MaaWin32InputMethodEnum.Seize,
    )

Source from the content-addressed store, hash-verified

856 """Win32 控制器 / Win32 controller"""
857
858 def __init__(
859 self,
860 hWnd: Union[ctypes.c_void_p, int, None],
861 screencap_method: int = MaaWin32ScreencapMethodEnum.Background,
862 mouse_method: int = MaaWin32InputMethodEnum.Seize,
863 keyboard_method: int = MaaWin32InputMethodEnum.Seize,
864 ):
865 """创建 Win32 控制器 / Create Win32 controller
866
867 Args:
868 hWnd: 窗口句柄 / window handle
869 screencap_method: 使用的截图方式 / screenshot method used
870 mouse_method: 使用的鼠标输入方式 / mouse input method used
871 keyboard_method: 使用的键盘输入方式 / keyboard input method used
872
873 Raises:
874 RuntimeError: 如果创建失败
875 """
876 super().__init__()
877 self._set_win32_api_properties()
878
879 self._handle = Library.framework().MaaWin32ControllerCreate(
880 hWnd,
881 MaaWin32ScreencapMethod(screencap_method),
882 MaaWin32InputMethod(mouse_method),
883 MaaWin32InputMethod(keyboard_method),
884 )
885
886 if not self._handle:
887 raise RuntimeError("Failed to create Win32 controller.")
888
889 def _set_win32_api_properties(self):
890 Library.framework().MaaWin32ControllerCreate.restype = MaaControllerHandle

Callers

nothing calls this directly

Calls 3

frameworkMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected