Pythonwin, DefWindowProc bug?

Keith Farmer kfarmer at thuban.org
Sat Feb 2 01:15:23 EST 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)
    43319512
    Traceback (most recent call last):
    File "D:\Python\wxAppBar\PyAppBar.py", line 52, in _OnWMNCHitTest
        self._LowHighWordsToLparam(win32api.GetCursorPos())
    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(),
                                                        WM_NCHITTEST,
                                                        0,

self._LowHighWordsToLparam(win32api.GetCursorPos())
                                                        )
        if (lr == HTBOTTOM or lr == HTBOTTOMLEFT or lr == HTBOTTOMRIGHT):
            return HTBORDER
        else:
            return lr

----------
Keith J. Farmer
kfarmer at thuban.org
http://www.thuban.org





More information about the Python-list mailing list