Pythonwin, DefWindowProc bug?

Keith Farmer kfarmer at
Sat Feb 2 07:15:23 CET 2002

I'm trying to intercept the WM_NCHITTEST message, to selectively disallow
resize for given window edges. The following code results in

    (216, 661)
    Traceback (most recent call last):
    File "D:\Python\wxAppBar\", line 52, in _OnWMNCHitTest
    TypeError: an integer is required

.. I am wondering where the error lies: my logic (am I creating lParam
incorrectly?), or is win32gui.DefWindowProc not accepting a wide enough
variable? I've got the constants elsewhere in the file, btw.

    def _LowHighWordsToLparam(self, lh):
        print lh
        print lh[1]*0x10000 + lh[0]
        return lh[1]*0x10000 + lh[0]

    def _OnWMNCHitTest(self, params):
        lr = win32gui.DefWindowProc(self._GetAppBarWnd(),

        if (lr == HTBOTTOM or lr == HTBOTTOMLEFT or lr == HTBOTTOMRIGHT):
            return HTBORDER
            return lr

Keith J. Farmer
kfarmer at

More information about the Python-list mailing list