How can I get a WinForms text control's text string, given a pointer to its CWnd.
Posted on 2014-09-16
I have a Winforms app whose window contains several controls. From a separate MFC process I need to be able to retrieve the value of one of the text controls in the Winforms app.
I enumerate those controls to get a CWnd pointer for each one. That all works fine.
The window has several pushbuttons and several text controls. On each pushbutton, when I call GetWindowText() I get the pushbutton's caption returned. As expected.
However when I call GetWindowText() on a text object I get nothing back even though there is clearly a non-null string there.
I'm assuming that one cannot use GetWindowText() on a Winforms text object but I don't know what I can use that would give me back the text that's stored within a text object.