here's how i do it
char tmp[0x7FFF] = {0};
LRESULT length = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0);
SendMessage(hWnd, WM_GETTEXT, length+1, (LPARAM)(void*)tmp);
the problem is when i open a large file i'm talking about maybe a 20mb text file, i can't seem to capture the text anymore. i know it's because the text of the 20mb file is larger than my char size. i think the max size of a char size is 0x7FFF.
what is the correct way to do it?
my goal is to capture the text and edit them.
--------------------------
this is just a follow up from what you guys gave me
ok i tried
char * tmp = new char[20*1024];
LRESULT length = SendMessage(hwndChild, WM_GETTEXTLENGTH, 0, 0);
SendMessage(hwndChild, WM_GETTEXT, length+1, (LPARAM)(void*)tmp);
and i got a bunch of characters which were 0xCC in value....
i tried
char tmp[0x7FFFFFFF] = {0};
LRESULT length = SendMessage(hwndChild, WM_GETTEXTLENGTH, 0, 0);
SendMessage(hwndChild, WM_GETTEXT, length+1, (LPARAM)(void*)tmp);
the compiler prevented me to compile it because it exceeds to gig, it tried removing 2 0xFF but i got a stack over flow....
i tried
std::string tmp;
LRESULT length = SendMessage(hwndChild, WM_GETTEXTLENGTH, 0, 0);
SendMessage(hwndChild, WM_GETTEXT, length+1, (LPARAM)(void*)tmp);
i got an error: error C2440: 'type cast' : cannot convert from 'std::string' to 'void *'
-------------------------
@richard
i do not wish to load anything, i just want to grab what's being displayed on the window. if my method is wrong please teach me how to do it properly. I also didn't understand what you mean by edit as the users scroll through it. is there a method to grab the content of what a user currently views on the window and not the entire window content?
To be more clear, for example i opened a fresh notepad. First it's empty and has a window title of "Untitled - Notepad". I will then press random keys on my keyboard for a whole day/week/month. Then i run my program. The program should be able to read whats on the notepad, find all acceptable english words, and display them as bold or different color on the same "Untitled - Notepad" window.