[python-win32] Returning objects from COM
Alias Alias
blipbeep at gmail.com
Sun Sep 26 05:26:35 CEST 2004
The short anwer... you probably can't. COM returns primitive types OR
other objects. You could return another IDispatch object (it's not a
python obj), and
then you could get properties from it. This object would be a COM object and
could be written in C++ or Python.
example:
o = win32com.client.Dispatch("MyOwnObject.Name")
person = o.getPerson("John Doe")
print person.Name
print person.UserID
..etc..
On Sat, 25 Sep 2004 17:12:08 +0200, Danie Roux <droux at tuks.co.za> wrote:
> I don't know COM at all, and fter spending a few hours being confused by
> this, I hope someone have an answer for me:
>
> How do I return a custom Python object from a COM server? All examples and
> literature I find only allows me to return primitive types.
>
> Basically I want this to work:
>
> o = win32com.client.Dispatch("MyOwnObject.Name")
> " person is a complex object of type Person
> person = o.getPerson("John Doe")
> print person.getName()
>
> --
> Danie Roux *shuffle* Adore Unix
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
More information about the Python-win32
mailing list