Refactor imports in ProjectView for clarity and maintainability
This commit is contained in:
13
croppa/utils.py
Normal file
13
croppa/utils.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import ctypes
|
||||
|
||||
|
||||
def get_active_window_title():
|
||||
"""Get the title of the currently active window"""
|
||||
try:
|
||||
hwnd = ctypes.windll.user32.GetForegroundWindow()
|
||||
length = ctypes.windll.user32.GetWindowTextLengthW(hwnd)
|
||||
buffer = ctypes.create_unicode_buffer(length + 1)
|
||||
ctypes.windll.user32.GetWindowTextW(hwnd, buffer, length + 1)
|
||||
return buffer.value
|
||||
except: # noqa: E722 - preserve original broad exception style
|
||||
return ""
|
Reference in New Issue
Block a user