Im working on a program that does little things to an AIM window. I can do a lot to the window in general, but now i want to be able to send text to the text box. How do i gain control of the text box?
Printable View
Im working on a program that does little things to an AIM window. I can do a lot to the window in general, but now i want to be able to send text to the text box. How do i gain control of the text box?
There are API functions to traverse the window tree. FindWindowEx might be especially interesting to you. Once you have the HWND you can use SetWindowText to set the window's text.
Does FindWindowEx work for the window or the textbox, or both?
A textbox is a window.
In that case couldn't I just use a regular FindWindow call? Either way what should I use as the caption of the textbox?
FindWindow doesn't find child windows.
You'd do something like (in C++, I'm not familiar enough with VB):
Note that this searches only immediate child windows of the parent. And I don't know how to identify the right edit box if there are several.Code:HWND hParent = GetMessengerMainWindow();
// This gets the first edit box (tab order) of
// the messenger:
HWND hChild = FindWindowEx(hParent, NULL, "EDIT", NULL);
// This gets subsequent edit boxes:
hChild = FindWindowEx(hParent, hChild, "EDIT", NULL);