[python-win32] Custom control, WS_CHILD
Thomas Heller
theller at ctypes.org
Sun Jan 13 13:03:38 CET 2008
Henry Baxter schrieb:
> Problem solved!
>
> I was using ctypes.byref to pass a reference to the window class, but before
> calling CreateWindow the window class in question went out of scope and was
> destroyed.
>
> I'm worried this type of problem will happen more often, but I'm not sure
> how to stop it...suggestions welcome!
I guess the important thing that needs to be kept alive is the ctypes-pointer
to your WindowProc. If the window class keeps a reference to the WindowProc
you could attach the window class to the Python class that implements the window.
Or you keep it in a global variable, it depends on how your code is structured.
You could also look into the venster code (google for it) for ideas.
Thomas
More information about the python-win32
mailing list