diff --git a/EDMarketConnector.py b/EDMarketConnector.py index ecc84e1bf..864462188 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -272,11 +272,7 @@ def handle_edmc_callback_or_foregrounding() -> None: # noqa: CCR001 def window_title(h: int) -> str | None: if h: - text_length = win32gui.GetWindowTextLength(h) + 1 - buf = create_unicode_buffer(text_length) - if win32gui.GetWindowText(h): - return buf.value - + return win32gui.GetWindowText(h) return None @WINFUNCTYPE(BOOL, HWND, LPARAM) diff --git a/hotkey/windows.py b/hotkey/windows.py index 95b1a83af..ddccc3330 100644 --- a/hotkey/windows.py +++ b/hotkey/windows.py @@ -47,11 +47,7 @@ def window_title(h) -> str: :return: Window title. """ if h: - title_length = win32gui.GetWindowTextLength(h) + 1 - buf = ctypes.create_unicode_buffer(title_length) - if win32gui.GetWindowText(h): - return buf.value - + return win32gui.GetWindowText(h) return ''