Re: Word Capture
"swapnil" <shahswapnil963@gmail.com> wrote in message
news:18316c78-8fda-44b7-a358-9dd2847a93b1@z6g2000pre.googlegroups.com...
Hi
I have used api hooking. and its looked positive. I have hooked
textoutA,TextOutW,ExtTextOutA,ExtTextoutW. but it is only called when
application gets resized or invalidated. so i send WM_PAINT message to
make application window to call TextOutXX api but application window
flickers. so i decided to invalidate the only RECT where actually
mouse is on and where i can get text. i am still working on how to
determine that exact RECT ? I believe that its difficult to capture
text even using api hooking. if u have tried to capture text, can u
explore something more.??
and OCR is very difficult to make generalize, highly unreliable and i
dont have idea abt it. so i would go for api hooking and try to find a
path.
It had not occurred to me to expressly invalidate a rect to discover the
text output. I had assumed you would hook and cache the text that was
written at all times, not just after the mouse was hovered over the desired
area. You may want to call LockWindowUpdate() so that the window does not
physically render when you invalidate it. That saves the flicker.
BTW, do you not hook DrawText, etc. as well? Perhaps that in turn calls one
of the functions you already hook, so you don't miss anything.
As to the RECT, that is hard. All you have is the (x,y) coordinates of the
top left corner of where the text is started, you have no idea the
coordinates of the bottom right corner where the text ends. But DrawText()
at least has a RECT as a parameter and not just the (x,y) of upper left
corner. Still, not all apps use DrawText. And even if you did have the
RECT, it might be the rect of the entire client area of the HWND, which is
too large for your purpose. I imagine you want the RECT of each word of
text that is output? Very hard.
For that reason, OCR may be the way to go. On-screen (as opposed to
printed) OCR is highly reliable. But I'm afraid I don't know how to do it,
sorry. There are many OCR engines available.
-- David