soriega
asked on
Getting all text from childwindows through EnumChildWindows
Hi. (I AM USING VB.net, visual Studio 2005)
I need to extract the text on buttons, on labels, in textboxes etc inside another window ( in my case its from a provider och financialdata, where i want to read numbers ) . How can i locate ALL childwindows inside the other application and extract that text. I have tried with making something out of a combination of
Declare Auto Function FindWindowEx Lib "user32"
and
Declare Function EnumChildWindows Lib "user32"
Basically I wan't ALL childwindows inside the MAIN Application.
Some info is here, but i don't exactly understand it.
http://www.xtremevbtalk.com/archive/index.php/t-130418.html
Say for example that i have the hWnd of the main window, and i wan't EVERYTHING that is a childwindow of hWnd, and also the "childwindows of the childwindow"
Thanks.
I need to extract the text on buttons, on labels, in textboxes etc inside another window ( in my case its from a provider och financialdata, where i want to read numbers ) . How can i locate ALL childwindows inside the other application and extract that text. I have tried with making something out of a combination of
Declare Auto Function FindWindowEx Lib "user32"
and
Declare Function EnumChildWindows Lib "user32"
Basically I wan't ALL childwindows inside the MAIN Application.
Some info is here, but i don't exactly understand it.
http://www.xtremevbtalk.com/archive/index.php/t-130418.html
Say for example that i have the hWnd of the main window, and i wan't EVERYTHING that is a childwindow of hWnd, and also the "childwindows of the childwindow"
Thanks.
Not entirely sure of this will help, but I did find this which seems to fit what you're looking for...
http://forums.devshed.com/net-development-87/vb-net-getting-url-from-ie-instances-390854.html
http://forums.devshed.com/net-development-87/vb-net-getting-url-from-ie-instances-390854.html
ASKER
Thanks, i will do some testing and se if it works
ASKER
As far as i Can see, this solution ( in the link ) returns only the title of windows. In the example it returns the title of each Iexplorer window. What i was looking for was rather ALL the childwindows that are UNDER the main window. For example. If i have a Form1 with a button, named "button1" and text button1.text="HELP" and a label with label1.text ="MYTEST", then what i want is a script that looks through Form1 and returns all the controls and labels, and the text of the childcontrols
Thanks
Thanks
To get the "text" of controls, you should use "getWindowText()". You won't be able to get the values from labels, though. Labels are not controls in the strictest sense of the word.
ASKER
OK, is there any way of reading values from say a datagrid in another application. I basically wan't to read numbers and try to execute trades at an application from a online broker. It seems like its some sort of datagridview or labels or textboxes or similar
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks for the explanation, i was prepared that it might not work. I will try to find some better (...more expensive) provider of stockprices
Will your application have web access? If so, you can make an http call to get a page which contains the data you need and can easily scrape it from there.
Most websites have a fifteen to twenty minute delay on stock prices, though, unless you buy a subscription.
Good luck.
Most websites have a fifteen to twenty minute delay on stock prices, though, unless you buy a subscription.
Good luck.
ASKER