[python-win32] Trouble with SetWindowLong().

Tim Golden mail at timgolden.me.uk
Sun Jan 16 11:49:10 CET 2011


On 16/01/2011 4:06 AM, Ben Timby wrote:
> I am using pywin32 214 on Windows XP 32 bit. I am calling SetWindowLong like so:
>
> --
> import win32api, win32con
>
> def fun():
>      print 'fun'
>
> h = win32api.GetCurrentProcess()
> win32api.SetWindowLong(h, win32con.GWL_WNDPROC, fun)
> --
>
> But receiving:
>
> TypeError: Unable to convert function to pointer-sized value
>
> My google-fu fails me. Any hints?

I'm puzzled: what do you think "SetWindowLong" is doing?
And why do you think that passing in a process handle
and a Python function will achieve it? And do you understand
what a WNDPROC function is?

This isn't sarcasm: it's bewilderment. I'm genuinely unsure
what you're trying to achieve and how you think that you
can achieve it with the above code.

Feel free to post back with a fuller explanation of your goals
and hopefully someone here can guide you towards a possible
way of achieving them.

TJG



More information about the python-win32 mailing list