Is it possible to read a label's text property of another app?
I know how to get the handle of the main window, and i got the code for the child.
But the problem is that there's like 20 other labels on the window and when i use winID to get it's class, it's just "Edit", and it's the same for all the labels. And the title is the value of the labels text property.
In particular, notice the repeated calls to FindWindowEx. The basic idea is that if you have 20 labels, and the one you want is label N, then it will ALWAYS be label N. You can then use FindWindowEx passing in the first handle, then the next handle, and so on for N-1 tries, and the next call will return the handle for label N. In the code I posted in that thread, the textbox I wanted was the third one, or something like that, and with so few, I just unrolled the loop and called FindWindowEx three times, but if N was higher, it would probably be easier to run the code in a loop.
Well i have been studying the code, but i just don't see how i'm going to use it.
What i understand (pretty sure it's wrong), is that it loops through all the labels by using the retrieved handle into a new FindWindowEx call? Or how?
I was hoping you wouldn't ask that, as the code was written about six years ago, and I have forgotten too much about it. Have you used Spy++ to take a look at the form in question? The target tool in Spy++ is neat, but not necessarily all that useful in this case. However, the treeview display of all the windows classes should be useful. I was using this display to design the code in that post. I saw that under a certain form, there were a string of controls that appeared to all have the same class type (that ATLfpOCXComboBox30). I then looped a call to FindWindowEx that passed in the last handle returned (from the last iteration of the loop) as the second argument. I can't currently find a reference for FindWindowEx, but I assume that the second argument tells FindWindowEx where to start looking for a class with the name that is passed in the third argument.
If you use Spy++, you should see that each label is a window, and see many labels with the same class type. If you can figure out which of those is the one you want (perhaps the target tool would help with that), then you can perform a similar loop to the one I had to make, to find the correct instance of the label class.
Well i started up spy++ instead of winID, and there's a lot of other properties, but not anyone i can think of can be used. Only one was the control id, but i don't think it can be used....