[python-win32] Errors (?) in win32con.py

Thomas Heller theller at python.net
Fri Sep 3 19:59:22 CEST 2004


I'm currently writing code to parse the windows header files and create
Python code from them - see recent articles in the ctypes-users mailing
list.

When I compare the output of my tools with the contents in win32con.py,
I see several differences.
One example is the (arbitrarily chosen) CDN_SELCHANGE symbol.

In the commdlg.h file I have I see this:

#define CDN_FIRST (0U - 601U)
...
#define CDN_SELCHANGE (CDN_FIRST - 0x0001)

Ignoring signed/unsigned issues (and not showing the FutureWarning from
Python 2.3):
>>> hex(0 - 601 - 1)
'0xfffffda6'
>>> import win32con
>>> hex(win32con.CDN_SELCHANGE)
'0x4efda6'
>>>

Looking into the win32con.py source code:

PY_0U = 5177344
CDN_FIRST = (PY_0U-601)
CDN_SELCHANGE = (CDN_FIRST - 1)

I'm puzzled.  What is PY_0U? 

hex(5177344) is 0x4F0000, but that doesn't enlighten me.

Reading about the CDN_* codes in MSDN, they are used in the NMHDR
structure's 'code' field, which is UINT.  So the value *is* 32-bit.

Thomas



More information about the Python-win32 mailing list