代码如下,基本都是模拟键鼠操作来完成的,不过现在有个新的需求
怎么才能在循环检测聊天记录的同时做到暂停或停止程序的运行
望路过的大佬指定一下
import win32gui
import win32api
import win32clipboard as wt
import win32con
import win32com
import time
from win32com.client import Dispatch
def get_hwnd(par):
"""获得窗口句柄,并返回句柄和窗口的左上角坐标"""
time.sleep(0.1)
hwnd = win32gui.FindWindow(None, par)
shell = win32com.client.Dispatch ("WScript.Shell")
shell.SendKeys("%")
win32gui.SetForegroundWindow(hwnd)
left, top, right, bottom = win32gui.GetWindowRect(hwnd)
return hwnd, left, top
def click(hwnd, cx, cy):
"""模拟鼠标点击"""
time.sleep(0.1)
win32api.SetCursorPos([cx,cy])
win32api.mouse_event(</