This commit is contained in:
恍兮惚兮 2024-08-30 00:52:12 +08:00
parent 4a6208a271
commit 438222e9db
4 changed files with 7 additions and 5 deletions

View File

@ -18,6 +18,8 @@ def grabwindow(app="PNG", callback_origin=None):
hwndx = gobject.baseobject.hwnd hwndx = gobject.baseobject.hwnd
if not hwndx: if not hwndx:
hwndx = windows.GetForegroundWindow() hwndx = windows.GetForegroundWindow()
else:
hwndx = windows.GetAncestor(hwndx)
gamepath = getpidexe(windows.GetWindowThreadProcessId(hwndx)) gamepath = getpidexe(windows.GetWindowThreadProcessId(hwndx))
exename = os.path.basename(gamepath).replace( exename = os.path.basename(gamepath).replace(
"." + os.path.basename(gamepath).split(".")[-1], "" "." + os.path.basename(gamepath).split(".")[-1], ""
@ -65,7 +67,8 @@ def grabwindow(app="PNG", callback_origin=None):
hwnd = gobject.baseobject.hwnd hwnd = gobject.baseobject.hwnd
if not hwnd: if not hwnd:
hwnd = windows.GetForegroundWindow() hwnd = windows.GetForegroundWindow()
else:
hwnd = windows.GetAncestor(hwnd)
_ = windows.GetClientRect(hwnd) _ = windows.GetClientRect(hwnd)
p = screenshot(0, 0, _[2], _[3], hwnd).toImage() p = screenshot(0, 0, _[2], _[3], hwnd).toImage()
if not p.allGray(): if not p.allGray():

View File

@ -431,9 +431,6 @@ def minmaxmoveobservefunc(self):
myhwnd = gobject.baseobject.hwnd myhwnd = gobject.baseobject.hwnd
if not myhwnd: if not myhwnd:
return return
mymyhwnd = windows.GetAncestor(myhwnd)
if myhwnd != mymyhwnd:
gobject.baseobject.hwnd = myhwnd = mymyhwnd
if ( if (
event == windows.EVENT_OBJECT_DESTROY event == windows.EVENT_OBJECT_DESTROY
and idObject == windows.OBJID_WINDOW and idObject == windows.OBJID_WINDOW

View File

@ -1,4 +1,5 @@
from myutils.wrapper import threader from myutils.wrapper import threader
import windows
class scalebase: class scalebase:
@ -20,6 +21,7 @@ class scalebase:
self.callstatuschange_(hwnd) self.callstatuschange_(hwnd)
def callstatuschange_(self, hwnd): def callstatuschange_(self, hwnd):
hwnd = windows.GetAncestor(hwnd)
self.hwnd = hwnd self.hwnd = hwnd
if self.changestatus(hwnd, self.full): if self.changestatus(hwnd, self.full):
self.setuistatus(self.full) self.setuistatus(self.full)

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5) set(VERSION_MAJOR 5)
set(VERSION_MINOR 31) set(VERSION_MINOR 31)
set(VERSION_PATCH 4) set(VERSION_PATCH 5)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)