M
Metalone
I would like to call
windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam)
where
lParam represents a pointer to an object.
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
x = X(1)
windll.user32.SendMessageA(hwnd, WM_COMMAND, 4000, addressof(x))
def wnd_proc(hwnd, msg, wParam, lParam):
if msg == WM_COMMAND and wParam == 4000):
x = X.from_address(lParam)
print x.v
Unfortunately, this does not work.
Also to my surprise the following does not work:
x1 = X(1)
x2 = X.from_address(addressof(x1))
addressof(x1) == addressof(x2) --> True
but
x2.v --> 'object has no attribute v'
x1.v --> 1
Also this does not work as I expect.
p = pointer(x)
p[0].v --> 'object has no attribute v'.
What am I doing wrong?
windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam)
where
lParam represents a pointer to an object.
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
x = X(1)
windll.user32.SendMessageA(hwnd, WM_COMMAND, 4000, addressof(x))
def wnd_proc(hwnd, msg, wParam, lParam):
if msg == WM_COMMAND and wParam == 4000):
x = X.from_address(lParam)
print x.v
Unfortunately, this does not work.
Also to my surprise the following does not work:
x1 = X(1)
x2 = X.from_address(addressof(x1))
addressof(x1) == addressof(x2) --> True
but
x2.v --> 'object has no attribute v'
x1.v --> 1
Also this does not work as I expect.
p = pointer(x)
p[0].v --> 'object has no attribute v'.
What am I doing wrong?