ctypes pointers and SendMessage

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Thu Jun 1 04:04:28 EDT 2006


Metalone wrote:
> I would like to call
> windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam)
> where
> lParam represents a pointer to an object.

and the others?

> 
> And also convert this pointer back to an object reference inside of
> wnd_proc
> def wnd_proc(hwnd, msg, wParam, lParam):
> 
> So something like this:
> class X(Structure):
>     def __init__(self, x):
>         self.v = x
> 
> What am I doing wrong?
> 


I don't know if you want to create a "real" C structure. If yes this is
the wrong method:

 >>> class X(Structure):
...  _fields_ = [("x", c_int), ]
...
 >>> x1 = X(1)
 >>> x1.x
1
 >>>

http://starship.python.net/crew/theller/ctypes/tutorial.html -> 
Structures and Unions

Michele



More information about the Python-list mailing list