win32gui

Tim Roberts timr at probo.com
Sat Jan 3 23:11:34 EST 2009


Gandalf <goldnery at gmail.com> wrote:
>
>I'm trying to capture the text word under the user cursor,
>so I was searching the win32 lib for functions I can use.

You should know that, in the general case, this is impossible.  Remember
that the screen image you are looking at is just a big array of dots.  If
the window underneath happens to be an image, there won't be any text to
fetch.

Now, in many cases it IS possible, but it's not easy.

>i used this to fined the controller under the cursor
>win32gui.WindowFromPoint(win32gui.GetCursorPos())
> to get the controller,

That's the first step.  Then, you need to figure out what kind of window it
is.  If it is a standard edit box, you can use the EM_GETLINE functions. If
it's a rich text edit box, you can use the rich text messages.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list