The final argument GetWindowText()is the size of your buffer. Since you set it to the length of the string, you tell the function that your buffer is too small because there is no room for a null terminator. And nothing is copied.
In addition, you should already allocate a buffer for storing copies of the text. What does it point to edittxt? I don’t even see where you initialized it.
Proper use will look something like this:
TCHAR buff[1024];
GetWindowText(hWndCtrl, buff, 1024);
source
share