WM_GETTEXT returns text separated with nulls
问题 import time import win32gui import win32con while True: time.sleep(1) buf = win32gui.PyMakeBuffer(255) window = win32gui.GetForegroundWindow() title = win32gui.GetWindowText(window) control = win32gui.FindWindowEx(window, 0, 'Edit', None) length = win32gui.SendMessage(control, win32con.WM_GETTEXT, 255, buf) result = buf[:length] print('Title: ', win32gui.GetWindowText(window)) print(str(buf[:length*2], "UTF_8") Why it returns string separated with nulls? When I've tried just buff[:length] I