'Trying to use win32con.WM_GETTEXT in a bitmap window instead of OCR methods
I am currently using Pytesserract to get data from another application where the data displayed is a bitmap window that is updated every 0.5 seconds. This works but I want to try and get the text without using ocr. That is, I want the data that is used to draw the bitmap. I am currently using win32con.WM_GETTEXT on a Panel Class that I copied from an example and it is returning "b'\x00\xee\xb4\x90\xc8\x81\x00\xe7\xa2\xb0\xee\xb4\x9c\xc8\x81\x00\xe4\x89\x90\xee\xb4\x90\xc8\x81\x00\x00\x00'", but I don't even know if this data is from the desired control. I have not been able to match what I think is hex to the decimal value displayed in the program.
import time
import win32gui
import win32con ###this one is working but returns unknown encoding###
bufLen=14
#win32gui.SendMessage(0x014804F2, win32con.WM_GETTEXTLENGTH)
##0x4309EC,0x64050A,0x1F0E04
buffer = win32gui.PyMakeBuffer(bufLen)
win32gui.SendMessage(0x014804F2, win32con.WM_GETTEXT, bufLen, buffer)
address, length = win32gui.PyGetBufferAddressAndLen(buffer)
text = win32gui.PyGetString(address, length)
print(text.encode("utf-8", "surrogateescape"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|