🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2412

Re: Getting text from an external Grid

#2412
From: Dan
Date: Thu, 01 Mar 2007 15:35
26 lines
2516 bytes
> There is an easier way.  You can copy the entire contents of a HWND
> using GetWindowDC() and BitBlt().  You do not have to deal with the
> individual pixels.

Humm.. I'll have to look at that; I had to use GetWindowDC to be able to 
access the pixels; didn't see BitBlt().  I did have three problems here 
though:
(1) I couldn't access the pixels unless the dialog I was copying was 
visibly on the screen; I was using the 
ShowWindow(MainWindow,SW_SHOWNORMAL); command to make the 'MainWindow' 
(a handle to the application I was copying) visible; however, it didn't 
bring it to the front and therefore the pixel grabbing didn't always 
work.  Is there a way to get the target application 'On Top' always, or 
a better way to grap the pixels that will work even if the target app is 
off screen, behind something else, or minimized?

(2) I couldn't find a clear way to get the height and width, in pixels, 
of the target I was copying.  Is there a way to grab the height in 
pixels of the target handle or DC?

(3) The OCR library I found didn't do that great of a job using just the 
screen image copied pixel by pixel, therefore to get the OCR to work 
better, I had to enlarge the image by a factor of two.  I guess this 
isn't a problem so much with the nativeapi; however, if anyone has ideas 
for 1 and 2 above, I hope that the solution keeps in mind that I will 
then have to scale the image up, potentially, so that OCR works.
Technical Details
Message-ID: <45e6f2f0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45e59a3a$1@newsgroups.borland.com> <45e5bb7e$1@newsgroups.borland.com> <45e5cfa5$1@newsgroups.borland.com> <45e5f6d3@newsgroups.borland.com> <45e5fd07$1@newsgroups.borland.com> <45e60f88$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3d58209a1f02789a
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 01 Mar 2007 09:35:07 -0600
From: Dan <Dan@do.not.spam>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Getting text from an external Grid
References: <45e59a3a$1@newsgroups.borland.com> <45e5bb7e$1@newsgroups.borland.com> <45e5cfa5$1@newsgroups.borland.com> <45e5f6d3@newsgroups.borland.com> <45e5fd07$1@newsgroups.borland.com> <45e60f88$1@newsgroups.borland.com>
In-Reply-To: <45e60f88$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.174.165.174
Message-ID: <45e6f2f0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1172763376 216.174.165.174 (1 Mar 2007 07:36:16 -0800)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail