returning list of strings from Python COM to Visual basic 6

Philippe C. Martin philippe at philippecmartin.com
Thu Jul 21 06:44:45 EDT 2005


Thanks a bunch,

I'll try this, This raises two questions:
1) How do I declare the receiving VB variable ?
2) Then, can I use the returned object as a COM object: call its public 
methods (that would be hot)?


Dim newobj as ?????
newobj = acom.Get_Obj()

newobj.A_Public()


Regards,

Philippe





On Thursday 21 July 2005 09:55 am, Stefan Schukat wrote:
> You have to wrap the python object with a COM object:
>
> def Get_Obj(self):
> 	return win32com.server.util.wrap(an_object)
>
>
> 	Stefan
>
> > -----Original Message-----
> > From: python-list-bounces+sschukat=dspace.de at python.org
> > [mailto:python-list-bounces+sschukat=dspace.de at python.org]On Behalf Of
> > Philippe C. Martin
> > Sent: Thursday, July 21, 2005 1:42 AM
> > To: python-list at python.org
> > Subject: Re: returning list of strings from Python COM to
> > Visual basic 6
> >
> >
> > I can now pass and return quite a few types except object
> > instances: my
> > python code gets to the point where I do:
> >
> >
> > def Get_Obj(self):
> > .....
> >         return an_object
> >
> > My VB code looks like
> >
> > Dim obj as Variant
> >
> > obj = acom.Get_Obj()
> >
> >
> > I get an "unexpected Python error ..... Objects of type
> > 'instance' can not
> > be converted to a COM VARIANT"
> >
> > Is there a way out ?
> >
> > Thanks,
> >
> > Philippe
> >
> > Philippe C. Martin wrote:
> > > Hi,
> > >
> > > Is it possible ?
> > >
> > > ex: return ['1','2']
> > >
> > > If so which type should I use in VB ?
> > >
> > > dim res as ???????
> > >
> > > Set testObj = CreateObject("xxxx")
> > >
> > > res = testObj.AMethodThatReturnsAListOfStrings()
> > >
> > >
> > > Thanks,
> > >
> > > Philippe
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
> The "Leading Manufacturing Test Company of the Year 2005"
> http://www.dspace.de/goto?f_s_award

-- 
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************



More information about the Python-list mailing list