Heading : How can I read a StringGrid content in another application's window?
I could get the StringGrid's handle
Heading : How can I read a StringGrid content in another application's window?
I could get the StringGrid's handle
A Delphi string grid is a pure VCL control. You cannot use windows messages to read its content. You cannot use any of the automation APIs because Embarcadero do not and have never made their controls accessible. For which, incidentally, shame on them.
The only viable way to do this is through gross hacking. If you know the memory layout of the control you can read its memory the same way as a debugger does. Using calls to ReadProcessMemory
. However, this will be exceptionally messy and hard to achieve.
A simple approach would be to inject a DLL into the target process. So long as your DLL is built with the same version of Delphi as the target process, there's a reasonable chance that you'll be able to read out the contents of the grid. You can then use IPC to send the information back to the other program.
Note that none of these solutions are remotely appealing. If you can find a cleaner way to do this, possibly avoiding this target process altogether, then you should give it strong consideration.