rambo 4 dias atrás
pai
commit
2bcb54b728
1 arquivos alterados com 20 adições e 1 exclusões
  1. 20 1
      python/api.py

+ 20 - 1
python/api.py

@@ -1830,4 +1830,23 @@ async def rename_shadow_folder(params:RenameShadow):
                             print(is_ok,msg)
                         print("goods_obj",goods_obj)
             success_result.append({"goods_art_no":goodsArt,"path":renameDstPath})
-    return {"code": 0, "message": "重命名完成", "data": {"result": success_result}}
+    return {"code": 0, "message": "重命名完成", "data": {"result": success_result}}
+
+
+
+@app.get("/minimize_window", description="最小化窗口")
+def minimize_window(window_title: str):
+    hwnd_list = []
+    if window_title == "" or window_title == None:
+       window_title = "Smart Shooter"
+    def callback(hwnd, _):
+        title = GetWindowText(hwnd)
+        if window_title in title or title == window_title:
+            hwnd_list.append(hwnd)
+
+    EnumWindows(callback, None)
+    if hwnd_list:
+        hwnd = hwnd_list[0]
+        win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)
+        return {"code": 0, "msg": "最小化成功", "data": {"status": True}}
+    return {"code": 0, "msg": "最小化失败", "data": {"status": False}}