[python-win32] hook to obtain WM_GESTURE

John Grant cyrfer at gmail.com
Thu May 9 17:54:35 CEST 2013


Hi,

I would like to obtain multi-touch events in my Python code (running inside
Blender's python environment). I have looked around the web for a python
module that works with py 3.3 (others work with py 2.x), but I have not
found one. So, I'm trying to build one.

I believe I can use the 'ctypes' to call the function I need,
GetGestureInfo. This function requires 2 parameters as input, the lParam
from WndProc and a pointer to the GESTUREINFO structure.

* I hope I can use 'ctypes' to declare the GESTUREINFO structure in my
python code.*
I see it is possible to pass structures as pointers using ctypes as well.

*** The problem seems to be obtaining the lParam from WndProc. ***

My idea is to provide a callback function (again using ctypes to declare
this callback) and use the SetWindowsHookEx function, passing my callback
and the WH_CALLWNDPROC hook ID.

Does this sound like it will work? I read somewhere that my callback needs
to be in a DLL. I'm not sure if the Blender python environment will count
as existing in a DLL. I hope I will not need to learn how to build a python
module from a C DLL just to put the callback in a DLL.



I signed up for the ML here because it seems like this is the best place
for Windows expertise concerning Python. I saw a few emails on this list
about hooks and callbacks. I've used the IDE with pywin32 for years - its
the best!

Many thanks for any help on this critical task for my 1st python consulting
gig.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130509/ad3136ad/attachment.html>


More information about the python-win32 mailing list