| ||
|
This community works best when people use their real names. Please
register for a free account.
Other Groups: Joel on Software Business of Software Design of Software (CLOSED) .NET Questions (CLOSED) TechInterview.org CityDesk FogBugz Fog Creek Copilot The Old Forum Your hosts: Albert D. Kallal Li-Fan Chen Stephen Jones |
Does anybody have any information on screen scraping windows applications? (there's no other access that I'm aware of to the contents) I need to capture small sections of the window and then OCR them, preferably using c# or VB. I'm trawling through MSDN but haven't found anything suitable yet.
I recall making a app that thumbnailed a desktop by finding the id of the root win (it might even have been 0) and then drawing it to an offscreen canvas. Pure WIN32. Can't remember the details, but that was win2000 so security couldn't have been an issue. Maybe I was running as administrator though ;-)
new nick, new rep Monday, July 25, 2005
GetDC(NULL) gives you a handle to the desktop DC. That's what screen grabbers (including the Print Screen key) do. On the other hand, if it's a lot of text, I would use some kind of "spy" program to extract the byte data directly from the app's window. Try Spy++ from Visual Studio to find out what kind of window it is -- a browser control, an edit control, a plain canvas drawn with DrawText, etc., and take it from there.
You can find code written in Purebasic for a screen magnifier here. Look at the AcquireImage() procedure to see the API calls in action. http://forums.purebasic.com/english/viewtopic.php?t=11548 The MS Documentation can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_87eb.asp
Are you sure that taking an image and OCR'ing is the best approach. Download the Accessible SDK from Microsoft http://www.microsoft.com/enable/ and use their sample AccExplorer32 to see if it can extract the data. If it can, the Accessible API are fairly simple to add to your own program.
Adrian Monday, July 25, 2005 | |
Powered by FogBugz
