I need to read the contents of an editbox (or possibly a richedit box) from another program, and I'm not at all sure how to do this. GetWindowText() works when called on editboxes from my own program, but it just returns an empty string when I've tried it on editboxes from other programs. Does anyone know how I could do this?
Comments
I havent tried this but might work, but why not send the control WM_COPY then read the text off the clipboard?
: I need to read the contents of an editbox (or possibly a richedit box) from another program, and I'm not at all sure how to do this. GetWindowText() works when called on editboxes from my own program, but it just returns an empty string when I've tried it on editboxes from other programs. Does anyone know how I could do this?
:
HWND dtop = GetDesktopWindow();
and then work with all or everyone of its child windows:
EnumChildWindows(dtop, &EnumChildProc, 0);
, being EnumChildProc() something like that:
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam) {
//Send the message to every window. You could specify only
//some childwindows by asking for its (Get)ClassName.
SendMessage(hWnd, EM_GetOrSetWhatYouWant, 0, 0);
return TRUE;
}
Hope useful.