views:

338

answers:

5

I want to create a program or use a program that will read the memory values out of another application. Does anyone know of an application/library that will do this?

The target app is this. I would like to read the exchange rate values from it.

I'm an experienced c# programmer, but have never worked with the Win32/user32 api which is what I'm assuming I'll have to deal with to pull this off.

Any help that gets me going in the right direction is greatly appreciated.

Update: I managed to use Spy++ to get the window handle, so I'm sure I can get the values some how.

A: 

It might be easier to scrape their data by automating a screenshot and then ocr process. If that's your goal.

Potentially relevant links:

opello
Though this solution smells a little, it might be the simplest solution with a good OCR library.
Ben S
A: 

May be this article helps - http://msdn.microsoft.com/en-us/magazine/cc163617.aspx, but I think it's not universal and for your task is better to get access directly to Forex API/Web-Service or try to catch needed data on network.

vansickle
+2  A: 

Typically an application creates controls in a dialog in a consistent manor, same ID, same order etc, so finding a control programatically is fairly simple. Using Spy++ find the control's ID and then you can search the windows created by the application for the desired control. Not being familiar with the app in question I cannot give specifics, but if Spy++ shows the value you desire, it is likely not difficult to obtain the value in your code.

What type of control is the value displayed in? You'll may be able to use GetDlgItemText to obtain the value once you have the parent window handle and control ID? To get the parent window try using EnumWindows.

Stephen Nutt
I couldn't get to the desired value, but I was able to get a handle for the container of where all the different exchange rates were. The only controls that showed up in the container, were the combo boxes to select a value (lot size).
Arron
When using Spy++, do all the controls show up under the same parent?
Stephen Nutt
The only controls that I see are the combo boxes for selecting the lot size, which are displayed right next to the digits I want to read, but the digit controls are not shown in spy++. Any suggestions on how to get to those?
Arron
In Spy++ you can right click on a window and select "Highlight" which flashes the selected window. If you highlight all the siblings of the combo boxes one at a time, do any of them flash a rectangle that encompasses the desired text?
Stephen Nutt
+1  A: 

Have you looked into AutoIT or AutoHotKey? Both of these open source options have well documented abilities to read text from application windows (and send keystrokes or mouseclicks to them).

AutoIT is very easy to use and well documented. An example of reading text from a window would be:

$text = WinGetText("title of window", "")
MsgBox(0, "Text read was:", $text)

This can be compiled into an executable.

Mrgreen
A: 

It is possible to screen-scrap things created with native windows controls; if that is the case, you should be able to see the controls using Spy++. But some times controls are implemented "by hand", and there is no way to screen-scrap them (e.g. some Java graphic toolkits play directly with the graphics, so everything day do is meaningless from the outside, or even some Office menus are implemented without using the menu control).

The Windows accessibility API is a possible way to screen-scrap the values; check if "Narrator", the screen reader that comes with windows, is able to read aloud your target application.

Xv