![]() |
|
[C] [C++] Win32 API - Modifying the text of a child window - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] [C++] Win32 API - Modifying the text of a child window (/showthread.php?tid=5803519) |
[C++] Win32 API - Modifying the text of a child window - Irritiable - Feb 23, 2018 Hello. Someone had a problem earlier. Despite the simplicity of the problem: It's slightly off-key for what one may expect. There are a few solutions that would ideally fit the problem, but this is the one I've chosen: Code #define _WIN32_WINNT 0x0500We use FindWindow() to grab the parent window's handle then FindWindowEx() to grab the child window (edit box, push button, rich text edit, static text, etc) handle. After this: We call on SendMessage() and pass it the WM_SETTEXT message (macro) along with the desired data that we'd like to re-assign to the child window. We could amend text to the child window, but that would require that we save the current text of the child control, then concatenate our new text with the old text and then finally call on WM_SETTEXT. Happy coding, y'all! 👍 |