Moderator note: Originally posted in http://www.daniweb.com/forums/thread269720.html
How can I retrieve the handle of a Windows Form texBox?
The property textBox->Handle is not the same thing.
Winapi, if there is a window (hwnd) that has a child Edit control with ID 1:
HWND hwnd_edit = GetDlgItem(hwnd, 1); size_t len = GetWindowTextLength(hwnd_edit); if(len){ char *buffer = new char[len+2]; GetWindowText(hwnd_edit, buffer, len+1); buffer[len+1] = '\0'; //And if it must be a string: std::string YourString(buffer); delete[] buffer; }