473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using win32gui.SendMessage and SysListView32 control

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,te xt)
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 '06 #1
3 7759
ge********@hotmail.com:
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
Dec 3 '06 #2

ge********@hotmail.com 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/d...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 '06 #3
Thanks for your help.
I will check them out.

Dec 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bill ramsay | last post by:
Dear all. I am using an existing hodge-podge of an application that runs on top of an Access database. This application dials up customer equipment, handshakes then downloads/uploads various...
5
by: Mark Overstreet | last post by:
I am trying to click a button in another window and I have it's hWnd value so I was trying to use Send message. Here is my code but it doesn't work as expected... response =...
3
by: Dave Rich | last post by:
Hi I am trying to access the listview items from a SysListView32 control in C#. I am using LVM.FINDITEM and LVFINDINFO through SendMessage to try to get the text from each column in the item (it...
2
by: sri2097 | last post by:
Hi all, I have to select a particular file (using the 'Browse') button in Windows. After this I need to populate the 'Open Dialogue Box' with the path of the file I need (I have the entier path of...
1
by: tommyk | last post by:
Hi I am using the following code to search for a given string in either a listbox or a combo box, but the function always returns the index as "-1". The function fires from the change event of a...
2
by: =?Utf-8?B?SXJmYW4=?= | last post by:
Hello, It may be a repeated question but I don't find the solution to the situation that I encounter in it. My application is monitoring another application that is built in VB6. The...
2
by: tristanlbailey | last post by:
I been scouring the Internet for an answer to my problem, and a couple of times thought I had almost found the answer, but still to no avail. I'm tying to use the Rich Edit class (riched20.dll),...
3
by: korean_dave | last post by:
How do I use the win32com API to manipulate IE windows ALREADY open? ie = Dispatch("InternetExplorer.Application") opens a new window. But I'd like to be able to find, of windows already open,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.