Re: How to capture another proccess's TStringGrid's content??



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
.



Relevant Pages

  • Re: These Hypocrisies are NOT the Christians problem
    ... Roll Call's annual list of the 50 richest Members of Congress hasn't changed ... owing to the drop in price of her stock in RealNetworks, ... one point her net worth was estimated at about $40 million, ... He also lists interests in a Denver mobile home community; ...
    (alt.sports.football.pro.ne-patriots)
  • Re: grow list by tail, pointer example recipe -- please comment
    ... manufacturing a pointer with that address. ... the next cons cell. ... believe these lists are in consecutive memory locations. ...
    (comp.lang.lisp)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.mfc)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.language)
  • Re: Pointer To A Vector Elements While Still Adding
    ... As I understand it, when you add an element to the end of a list, memory is ... there is sufficient capacity. ... elements to 10,000 lists. ... better to allocate them statically). ...
    (comp.lang.cpp)