Using win32gui.SendMessage and SysListView32 control

Discussion in 'Python' started by geskerrett@hotmail.com, Dec 3, 2006.

  1. Guest

    Hope someone can steer me in the right direction.

    I am trying to use python to collect the values from a Win32
    application's control.
    I can successfull query an retreive the values ListBox, Edit and
    Buttons, however, the application uses a control called a
    'SysListView32' Control. MSDN says that this descends from CListView
    control and the msdn website reference for this control is;
    http://msdn2.microsoft.com/en-gb/library/ms670560.aspx
    (scroll to the message constants)

    This page seems to imply that the control can be queried with messages,
    however, my problem seems to be that pywin32.win32con does not define a
    constant for the LVM series of messages.

    Any other suggestions ??

    I am looking for something similar to code below which does a fine job
    of collecting all of the text values from a "ListBox" control;

    count = win32gui.SendMessage(hndl,win32con.LB_GETCOUNT)
    vals = []
    for i in range(count):
    strlen = win32gui.SendMessage(hndl,win32con.LB_GETTEXTLEN)
    text = ' '*(strlen+1) #Buffer for returned text -50
    characters
    lentext =
    win32gui.SendMessage(hndl,win32con.LB_GETTEXT,i,text)
    txt = text[0:lentext]
    print "Hndl: %8s Class: %-10s TxtLen:%3s TxtVal: %s " %
    (hndl,clname,lentext,txt)
    vals.append(txt.strip())

    Thanks in advance.
     
    , Dec 3, 2006
    #1
    1. Advertising

  2. Neil Hodgson Guest

    :

    > This page seems to imply that the control can be queried with messages,
    > however, my problem seems to be that pywin32.win32con does not define a
    > constant for the LVM series of messages.


    These are defined in win32/lib/commctrl.py in my installation.

    Neil
     
    Neil Hodgson, Dec 3, 2006
    #2
    1. Advertising

  3. Guest

    schrieb:

    > Hope someone can steer me in the right direction.
    >
    > I am trying to use python to collect the values from a Win32
    > application's control.
    > I can successfull query an retreive the values ListBox, Edit and
    > Buttons, however, the application uses a control called a
    > 'SysListView32' Control. MSDN says that this descends from CListView
    > control and the msdn website reference for this control is;
    > http://msdn2.microsoft.com/en-gb/library/ms670560.aspx
    > (scroll to the message constants)
    >
    > This page seems to imply that the control can be queried with messages,
    > however, my problem seems to be that pywin32.win32con does not define a
    > constant for the LVM series of messages.
    >
    >


    All the relevant message ids are in comCtl.h a 340k file. This might
    explain why
    win32con does only cover some ids. Best is to download and install the
    platform sdk,
    wich you may get for free from Microsoft. It comes shipped along with
    all the headers
    and the complete documentation for all the apis windows offers the
    dedicated programmer.

    http://www.microsoft.com/downloads/...35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en


    And ...just a hint, check the ctypes module, wich will give you full
    access to all the
    apis windows has to offer and lets you translate C code almost 1:1 to
    python.

    Regards J├╝rgen
     
    , Dec 3, 2006
    #3
  4. Guest

    Thanks for your help.
    I will check them out.
     
    , Dec 4, 2006
    #4
    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. =?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,267
    =?ISO-8859-1?Q?Thomas_N=FCcker?=
    Jun 25, 2003
  2. 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:
    846
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Jun 27, 2003
  3. Corwan
    Replies:
    1
    Views:
    482
    Mark Hammond
    Feb 1, 2004
  4. ME
    Replies:
    7
    Views:
    229
  5. Maxim Ap
    Replies:
    2
    Views:
    367
    Maxim Ap
    Feb 2, 2011
Loading...

Share This Page