By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,246 Members | 1,480 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,246 IT Pros & Developers. It's quick & easy.

-- Pythonic control of Windows GUI application: tabs and listviews

P: n/a
-- Pythonic control of Windows GUI application: tabs and listviews

Dear Snake-charming Gurus,

I have learned to manipulate some controls ("Button", "ComboBox", etc)
through such means as:

win32gui.SendMessage(hwnd, win32con.BM_GETCHECK, 0 ,0)
win32gui.SendMessage(hwnd, win32con.CB_GETCOUNT, 0 ,0)

provided by Python Win32 Extensions, and understand that such
constants as:

win32con.BM_GETCHECK
win32con.CB_GETCOUNT

corresponding to distinct messages (documented at [1] and [2]) that
can be sent to such controls.

For the "List-View" and "Tab" controls then, I expected to find the
constants

win32con.LVM_GETCHECK
win32con.TCM_GETITEMCOUNT

corresponding to the distinct messages documented at [3] and [4].
Unfortunately the module win32com module does not have any LVM_* or
TCM_* attributes, and I have not found reference to such constants in
the Extensions documentation.
I want to control a windows app through the GUI, but I do *not* want
to resort to 'mouseclick/keypress recorder' type tools. For now, I
seem to be able to work the Button and Combobox controls for a target
window while another window is running full screen mode, and I want to
keep it that way. But some of the controls I need can be reached only
by mamipulating Tab and Listview controls.

Do you have any advice on how I might control these controls in a way
similar to my controling Buttons and Comboboxes? Or, failing that, do
you have an entirely different route for me controlling one app while
a second is running maximized?

Much thanks!!
- Bryan Hann
[1] http://msdn.microsoft.com/library/de...m_getcheck.asp
[2] http://msdn.microsoft.com/library/de...b_getcount.asp
[3] http://msdn.microsoft.com/library/de...titemcount.asp
[4] http://msdn.microsoft.com/library/de...titemcount.asp
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
za*****@yahoo.com (zapazap) writes:
-- Pythonic control of Windows GUI application: tabs and listviews

Dear Snake-charming Gurus,

I have learned to manipulate some controls ("Button", "ComboBox", etc)
through such means as:

win32gui.SendMessage(hwnd, win32con.BM_GETCHECK, 0 ,0)
win32gui.SendMessage(hwnd, win32con.CB_GETCOUNT, 0 ,0)

provided by Python Win32 Extensions, and understand that such
constants as:

win32con.BM_GETCHECK
win32con.CB_GETCOUNT

corresponding to distinct messages (documented at [1] and [2]) that
can be sent to such controls.

For the "List-View" and "Tab" controls then, I expected to find the
constants

win32con.LVM_GETCHECK
win32con.TCM_GETITEMCOUNT

corresponding to the distinct messages documented at [3] and [4].
Unfortunately the module win32com module does not have any LVM_* or
TCM_* attributes, and I have not found reference to such constants in
the Extensions documentation.


These constants are defined in the 'commctrl' module:

Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import commctrl
commctrl <module 'commctrl' from 'C:\Python23\lib\site-packages\win32\lib\commctrl.pyc'> commctrl.LVM_GETITEMCOUNT 4100 commctrl.TCM_GETITEMCOUNT

4868

Thomas
Jul 18 '05 #2

P: n/a
zapazap wrote:
For the "List-View" and "Tab" controls then, I expected to find the
constants

win32con.LVM_GETCHECK
win32con.TCM_GETITEMCOUNT


FYI, A good source of sample code for working with tree-view controls
can be found in the SpamBayes project, specifically:
http://cvs.sourceforge.net/viewcvs.p...py?view=markup

Working with these win32gui structures is a complete PITA (as it needs
to be done via the 'struct' module) - I'd like to integrate support for
ctypes structures to make this more readable. In fact, I'd love to see
ctypes structure support as a standard library module, but that is for
another thread in a another forum <wink>

Mark

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.