Capturing data from a separate application window?

  • Thread starter Thread starter Wade
  • Start date Start date
W

Wade

Hi all,

I have found that I need to be able to write a windows application that is
capable of attaching to an independent windows application (one I haven't
written), and gather information. For example, this application gathers a
bunch of data from disparate sources, and updates a log file every 10
minutes. However, the data is rendered to a textbox (or at least it looks
like a textbox) in the application in real-time. So, I want to be able to
attach to this window and get this data in real-time as well, so that I
don't have to wait 10 minutes for this logs to update.

Does that make sense?

That said, I have no idea where to begin. I've found some applications that
seem capable of doing this, but I don't know how it is they are doing it.

If anyone has any information that they would be willing to share, to get me
started and headed in the right direction, I would really appreciate it.

Thanks!

Wade
 
Hello, Wade!

This sounds like you want to have IPC. If you will write both application you can consider following mechanisms:
- sockets
- remoting
- MMF
- named pipes

Then application will work like this: it will gather information from different sources and send the obtained data to connected socket. The second app will receive data sent via socket.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Hi Vadym,

While I'm sure this is a great tool, I'd really like to be able to somehow
attach to this application / process and get the information out of it.
It's already gathering loads of data (not just network data), and also
performing a lot of number crunching.

Is there a way to identify the process and/or thread, attach to it, and
somehow listen to what's going on in the other application?

Thanks,

Wade
 
Hello, Wade!

You're talking like you want the behavior of the debugger. This is wrong way to retrieve data from the app.
If you have no possibility of writing IPC module for the 1-st app, you can install FileSystemWatcher for the log file. This watcher will notify your app that there are changes in the log file.

Another way is to write unmanaged hook, that will process all the I/O of the 1-st app, however this is not simple task.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Vadym,

Thanks again for your reply. Your second suggestion is exactly what I'm
looking for -- I am not concerned with it being difficult. Could you point
me in the right direction? Any articles or examples that I can look at?

Thanks,

Wade
 
Back
Top