Re: How to capture another proccess's TStringGrid's content??
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Fri, 08 Feb 2008 08:54:41 -0600
tom wrote:
On Feb 8, 7:51 am, Rob Kennedy <m...@xxxxxxxxxxx> wrote:tom wrote:I'm trying to write some program(in C++ or C#) to capture the content
of a TStringGrid, which is basically a list of stock prices, in a
Delphi program. Would that be possible? How to do that?
Thanks for your reply! The stock program which I am trying to capture
it's content is a special program for local options market, so It's
the only available data source for me.
That program must be getting its data from somewhere, unless that program *is* the stock market for this local area (in which case I'd be quite worried).
If C++/C# is not possible, what about write another delphi program to
capture the content? or can I see a list of it's public functions from
the EXE file?
The language is irrelevant. You have a few problems:
1. You're generally not allowed get data from another running program without its cooperation. The API provides ways for specific messages to transport data between processes, and so the wm_GetText message looks tempting, but the recipient of that message needs to know to handle it. TStringGrid doesn't populate the buffer with all the strings it knows about. That's not just TStringGrid's shortcoming, though; you won't get full text from any control that has more than one text field, so you're pretty much limited to edit boxes and rich edit controls.
2. You can use ReadProcessMemory to read whatever memory you want, but then you need to figure out which memory you want. Being written in Delphi wouldn't help your program because TStringGrid doesn't have a set memory layout for its grid data. It keeps a sparse list of sparse lists of strings, and moving things around visually doesn't move them around in memory. Even if the program you're looking to probe doesn't take advantage of the sparseness or the fast column-rearranging, the memory layout still has lots of indirection to support those features.
3. It's not your program. Any update to that program, and yours is probably broken. (And don't try blaming your program's breaking on the stock program's update. That's what the blog I linked to was talking about.)
--
Rob
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to capture another proccess's TStringGrid's content??
- Next by Date: Re: How to capture another proccess's TStringGrid's content??
- Previous by thread: Re: How to capture another proccess's TStringGrid's content??
- Next by thread: Re: How to capture another proccess's TStringGrid's content??
- Index(es):
Relevant Pages
|