I would like to 'screen scrape' data from a (non web based) application, there is no API (legacy), and I am wondering if I can do this in C++? Would I be better attempting this in Visual C++?
Any help or pointers would be greatly appreciated.
First, the term "Visual C++" has nothing to do with vision/visual data; it's just Microsoft's particular implementation of C++ and IDE/tooling. It's still just C++.
There's tons of different ways for GUIs to be implemented. You might want to search for automation libraries, since they pretty much do the same thing (programmatically look at or interact with a GUI). If you know specifically what kind of framework the GUI in question uses, it will probably be easier to develop a solution.
you can capture the graphics card's buffer in any language/compiler/ide etc with the right libraries.
you can use OCR on this and get most of the text out, as well. OCR isnt too difficult; I built one 20+ years ago that could read almost anything that was not human written. Handwriting is another story, but that isnt what you described.
If it's using native Windows controls it's usually fairly easy, because the application constructs a tree of controls similar to a web page's DOM: there's a top-level window that's a child of the desktop, and then all controls used by the process are either a child of that window or a child of another control. You just find the top-level Windows via EnumWindows() and then walk the control tree until you find what you're looking for.
There's this tool called Spy++ that's included with Visual Studio that lets you inspect the control tree of all Windows in your desktop environment. On my installation it's in the following locations:
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\spyxx.exe
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\spyxx_amd64.exe
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\spyxx.exe
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\spyxx_amd64.exe
If the application is not using native Windows controls then it's more difficult.
I guess I assume people who have to ask such things are not doing anything illegal.
A sonar system I worked on did not tell you in its interface the range it was set to (you could set it in code, but not get it -- it was not designed to have a human pressing buttons AND a software package also pressing buttons at the same time so they assumed since you set it, you knew what it was), but it had it on the display, so I pulled it out of the graphical display. Also some game modders do things like this. You should not have to do it, but not everything supports grabbing every piece of data someone might want.
I guess I assume people who have to ask such things are not doing anything illegal.
That's a reasonable assumption and partly why I chose my words carefully.
But like the recent advice we gave regarding software licences etc, @OP might get mixed up in something or held responsible for something that idle and innocent curiosity can lead to a jail sentence.
Whatever @OP does my ( admittedly conservative and risk averse) advice is to be careful and only test the ideas out on his/her own machine - go outside that and it could be easily misunderstood - it's a jungle out ...
Whose side were you on when you were scraping sonar screens, @jonnin?
our side, of course :)
it was just a fishing sonar on a tiny little boat. (4 people if it didnt have all the equipment on it where the seats used to be). To keep from running into shallows / hitting the shore.
Hison is a piece-of-shit spammer. People need to be on the look-out for this species of turd. They are recognizable by their meaningless posts. His first post was "It's a "double hour" thing to do.". He should have been deleted at that point. Above is another meaningless post, while the middle three posts are advertisements.