[python-win32] LP_WNDCLASS vs pointer to WNDCLASS

Henry Baxter henry.baxter at gmail.com
Thu Jan 17 15:42:56 CET 2008


Somehow I managed to forget about the wintypes module :) I stopped using it
because it didn't define a lot of stuff I was using, but I'll be sure to use
it from now on, and only add new definitions in my code, to avoid the
confusion and redefinition.

Thank you for the help

On Jan 17, 2008 3:50 AM, Thomas Heller <theller at ctypes.org> wrote:

> Henry Baxter schrieb:
> > Hello,
> >
> > I keep getting this error, and I cannot figure out why. I have code that
> > registers a window class that works, and code that does not. Both bits
> of
> > code create a WNDCLASS, both use byref(thewndclassinstance), both make
> sure
> > there is always a reference to the window class structure instance to
> ensure
> > it is not destroyed. Here is the error.
> >
> > ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>:
> expected
> > LP_WND
> > CLASS instance instead of pointer to WNDCLASS
> >
> > Why would byref sometimes create an LP_WNDCLASS, and sometimes a
> 'pointer to
> > WNDCLASS'?
>
> This problem probably happens when you have several WNDCLASS classes
> defined,
> perhaps in several modules.  These classes are similar, but separate, and
> ctypes
> isinstance checks fail.
>
> You should always use the WNDCLASS defined in ctypes.wintypes instead of
> defining
> your own.  In ctypeslib dynamic modules, you should place a 'from ctypes
> import *'
> and 'from ctypes.wintypes import *' at the top.
>
> 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/20080117/fe312e78/attachment.htm 


More information about the python-win32 mailing list