Here my function:
def getEditText(hwnd):
result = []
bufferlength = struct.pack('i', 255)
linecount = win32gui.SendMessage(hwnd, win32con.EM_GETLINECOUNT, 0, 0)
print"--- linecount :",linecount
for line in range(linecount):
linetext = bufferlength + "".ljust(253)
linelength = win32gui.SendMessage(hwnd, win32con.EM_GETLINE, line, linetext)
myLigne=linetext[:linelength]
print" ",myLigne
result.append(myLigne)
return result
resultat=getEditText(hwmdTexte)
I want to get the text from a widget but this doesn't work. There are several lines in the widget of my application but I have linecount=0 and of course no text... Could you please help me.
Thanks for your answer. I've just tried def
GetText(hwnd):
buf_size = 1 + win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0)
buffer = win32gui.PyMakeBuffer(buf_size)
win32gui.SendMessage(hwnd, win32con.WM_GETTEXT, buf_size, buffer)
return buffer[:buf_size]
But this doesn't get the text of my widget. This function returns NUL...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.