[C++-sig] Wrapping and Passing HWND with Boost.Python
Ehsan Pi
ehsanpii at gmail.com
Mon Apr 30 20:54:04 CEST 2012
Thanks Roman for your quick reply,
That's what confuses me. HWND is essentially a pointer to an int to hold
the window handle. How can to convert them to each other?
Ehsan
On Mon, Apr 30, 2012 at 2:46 PM, Roman Yakovenko
<roman.yakovenko at gmail.com>wrote:
> On Mon, Apr 30, 2012 at 9:11 PM, Ehsan Pi <ehsanpii at gmail.com> wrote:
> > In python I get the not-match error:
> >
> > >>> import MyWrapper
> > >>> import win32gui
> > >>> hwnd = win32gui.GetDesktopWindow()
> > >>> foo = MyWrapper.Foo(hwnd)
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > Boost.Python.ArgumentError: Python argument types in
> > Foo.__init__(Foo, int)
> > did not match C++ signature:
> > __init__(struct _object *, struct HWND__ * window)
> > >>>
> >
> > How can I correct this problem to be able to pass a window's handle (from
> > win32gui) in Python to C++ class, and interact with it?
>
> I think the error is pretty clear: the exported constructor expects a
> pointer to some struct(?) HWND__, while, win32gui returns the handle
> as integer. You will have to find some way to associate handle as
> integer with handle as HWND__. Once you find it, you can use
> "make_constructor" functionality, which is also supported by py++.
>
> HTH.
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20120430/e8b19b79/attachment-0001.html>
More information about the Cplusplus-sig
mailing list