win32gui

Discussion in 'Python' started by Gandalf, Jan 3, 2009.

  1. Gandalf

    Gandalf Guest

    Hi,
    I'm trying to capture the text word under the user cursor,
    so I was searching the win32 lib for functions I can use.
    i used this to fined the controller under the cursor
    win32gui.WindowFromPoint(win32gui.GetCursorPos())
    to get the controller, but then when I try to read the text with this
    GetWindowText function it most of the time doesn't work, all the
    "getline" methon like the following didn't worked in most of the time
    too
    win32gui.SendMessage(hwnd, win32con.EM_GETLINE, line, linetext)

    I found this GetCharFromPosition in a VB forum which sound promising
    but unfortunately it's not part of the win32gui for python

    so now i'm looking for a reliable way to rich text from a controller
    or position if you know a function who may do it or a better way
    please tell me/
    thank you and have a nice day
    Gandalf, Jan 3, 2009
    #1
    1. Advertising

  2. Gandalf

    Tim Roberts Guest

    Gandalf <> 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,
    Providenza & Boekelheide, Inc.
    Tim Roberts, Jan 4, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Torjo

    [ann] WIN32GUI - v1.5.1 released

    John Torjo, Oct 13, 2004, in forum: C++
    Replies:
    32
    Views:
    1,025
    Ioannis Vranos
    Oct 29, 2004
  2. Replies:
    1
    Views:
    413
    matthias_k
    Jan 26, 2005
  3. =?ISO-8859-1?Q?Thomas_N=FCcker?=

    Embedded Python and Tkinter / win32gui

    =?ISO-8859-1?Q?Thomas_N=FCcker?=, Jun 24, 2003, in forum: Python
    Replies:
    2
    Views:
    1,255
    =?ISO-8859-1?Q?Thomas_N=FCcker?=
    Jun 25, 2003
  4. Martin v. =?iso-8859-15?q?L=F6wis?=

    Re: Compiling Python with Tkinter and win32gui

    Martin v. =?iso-8859-15?q?L=F6wis?=, Jun 27, 2003, in forum: Python
    Replies:
    0
    Views:
    831
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Jun 27, 2003
  5. Jay O'Connor

    STrange error importing win32gui

    Jay O'Connor, Nov 12, 2003, in forum: Python
    Replies:
    4
    Views:
    383
    Mark Hammond
    Nov 13, 2003
Loading...

Share This Page