Skip to content

Commit

Permalink
[1805] Simplify Window Text Call
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Jun 18, 2024
1 parent d319dd0 commit c0deeeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions EDMarketConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions hotkey/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''


Expand Down

0 comments on commit c0deeeb

Please sign in to comment.