From 9dede2eaa1d3e68be387c5fd612eb48226a54c9d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 04 八月 2023 16:07:22 +0800 Subject: [PATCH] HOST修改 --- win32_util.py | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/win32_util.py b/win32_util.py index b8297f3..37d9aa5 100644 --- a/win32_util.py +++ b/win32_util.py @@ -44,13 +44,19 @@ win32gui.PostMessage(hwnd, win32con.WM_KEYDOWN, code, 0) win32gui.PostMessage(hwnd, win32con.WM_KEYUP, code, 0) + def visual_keyboard_F5(hwnd): win32gui.PostMessage(hwnd, win32con.WM_KEYDOWN, win32con.VK_F5, 0) win32gui.PostMessage(hwnd, win32con.WM_KEYUP, win32con.VK_F5, 0) - -def window_capture(hwnd, rect): +# rect鏍煎紡涓猴細锛堝乏,涓�,鍙�,涓嬪潗鏍囷級 +def window_capture(hwnd, rect, scale): + rect_ = win32gui.GetWindowRect(hwnd) + ow = rect_[2] - rect_[0] + oh = rect_[3] - rect_[1] + ow = int(ow * scale) + oh = int(oh * scale) w = rect[2] - rect[0] h = rect[3] - rect[1] if w == 0 or h == 0: @@ -68,9 +74,10 @@ # 灏嗘埅鍥句繚瀛樺埌saveBitMap涓� saveDC.SelectObject(saveBitMap) # 淇濆瓨bitmap鍒板唴瀛樿澶囨弿杩拌〃 - saveDC.BitBlt((0, 0), (w, h), mfcDC, (rect[0], rect[1]), win32con.SRCCOPY) + saveDC.BitBlt((0, 0), (ow, h), mfcDC, (rect[0], rect[1]), win32con.SRCCOPY) + # saveDC.BitBlt((0, 0), (w, h), mfcDC, (0, 0), win32con.SRCCOPY) # 淇濆瓨鏁版嵁 - saveBitMap.SaveBitmapFile(saveDC, "test.png") + # saveBitMap.SaveBitmapFile(saveDC, "test.png") signedIntsArray = saveBitMap.GetBitmapBits(True) @@ -89,7 +96,6 @@ if __name__ == "__main__": # print(search_window("鍓睆1")) # visual_click(0x00152876, (110, 90)) - x = 1500 +67 - y = 400 + 4 - window_capture(0x00010BA2,(x,y,x +45,y+16)) + + window_capture(0x00010986, (0, 0, 1920, 895)) # pass -- Gitblit v1.8.0