开发者

Modifying a window's textbox control's text

开发者 https://www.devze.com 2022-12-22 01:30 出处:网络
Case in point : I\'ve got a handle to a window (for instance, using the getForegroundWindow() API function). This window\'s got a textbox (possibly a richtext contr开发者_JS百科ol). Would it be possib

Case in point : I've got a handle to a window (for instance, using the getForegroundWindow() API function). This window's got a textbox (possibly a richtext contr开发者_JS百科ol). Would it be possible to modify the textbox's text through an Windows API call ? More specifically, I'd like to replace its text with some of my own.


Once you have the handle to the parent window, you need to get the handle to the editcontrol.

If the editcontrol has a known, consistent identifier, use GetDlgItem to get its HWND. Otherwise you will need to resort to FindWindowEx.

Once you have the HWND of the editcontrol, you can use SendMessage to send a WM_SETTEXT message it. For rich text controls, use the EM_SETTEXTEX message.

0

精彩评论

暂无评论...
验证码 换一张
取 消