[python-win32] Custom control, WS_CHILD

Henry Baxter henry.baxter at gmail.com
Sun Jan 13 23:51:56 CET 2008


Thanks for the tip, venster not only has a neat way to resolve this issue,
but plenty of other really useful things (lists of windows constants and
other stuff that take time to assemble).

On Jan 13, 2008 4:03 AM, Thomas Heller <theller at ctypes.org> wrote:

> 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
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



-- 
Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080113/5c357b3e/attachment.htm 


More information about the python-win32 mailing list