Click to See Complete Forum and Search --> : reading an exe


bhavanaindia
October 10th, 2008, 03:51 AM
Hi friends.
I had been searching the net for last many days but diid not get any idea about "can we read out an exe?"
My problem is :

I have an exe which is l ike a form.It takes an input number and generates 2 output numbers. which are displayed on the form.
the numbsers are regenerated after every 30 seconds.
I want to get these number out of the exe ,and store in some variable.

If any body suggest any solution, please tell the API also.
I want to do it on windows using c++.
(any other language may also work but paltform is windows).

NOTE: we dont have the code of the exe.

olivthill
October 10th, 2008, 06:36 AM
Use autoit, see http://www.autoitscript.com/autoit3/
This is a language dedicated to handle programs made by others.
You could do the same thing in C, of course, but using autoit is much easier, even though autoit requires a little bit of knowledge in the beginning.

bhavanaindia
October 10th, 2008, 08:13 AM
I am thankful for the reply.
But did not get anything going to the above mentioned link.
can u give me some more clues?
actaully i did not get any examples over there of reading an exe file.
can u tell me C and c++ solution also?
it could be easy.

any suggestion is welcomed :)

fred100
October 10th, 2008, 10:05 AM
If output numbers are in Edit controls, just read them from their handle

kirants
October 10th, 2008, 01:11 PM
Elaborating on fred100's reply, a typical approach would be:

First figure out the target window relations using a tool like Spy++. Find the app's main window name or something that would help identify the application. Go down it's window tree to locate the controls you are interested in and note their control IDs. This will be useful later on.
In your application, first reach the target app's main window using EnumWindows or FindWindow.
Once you have reached it, use this to enumerate all child windows under it using EnumChildWindows. In each step use GetWindowLong to get the GWL_ID and compare it with the ID you are interested in and if it is, save these.
Use these handles to GetWindowText and retrieve the values. ( or another approach is to hook to the process and sniff out the WM_SETTEXTs on the hWnds.

Nitroglycerine
October 15th, 2008, 03:34 PM
If output numbers are in Edit controls, just read them from their handle

Yes like this in the program write the numbers in a file and in the other one read them from the file.