out parameters in Python and COM

Stefan Schukat SSchukat at dspace.de
Mon Oct 21 08:18:12 EDT 2002


You should use the makepy generated wrapper. The dynamic dispatch
does not support out parameters. 

So following should work:

from win32com.client.gencache import EnsureDispatch
 
atm = EnsureDispatch("ATM.Shell")
b4 = atm.LogOn("Administrator", "EHSW", "Python")
 
 
HEMgr = atm.ATMHeadEndManager
HEMgr.SetCodeTable("BS","ES","EE")
Ret, a, b, c = HEMgr.GetCodeTable("","","")


	Stefan

> -----Original Message-----
> From: Henk at relay.trans-it.de [mailto:Henk at relay.trans-it.de]
> Sent: Monday, October 21, 2002 10:36 AM
> To: python-list at python.org
> Subject: out parameters in Python and COM
> 
> 
> Hi,
> 
> Code snippet at the end of the post.
> 
> I have an exe which exposes some functionality through an IDispatch
> interface. The GetCodeTable-method has 4 parameters:
> first 3 are [out] BSTR*
> last one [out,retval] long *
> 
> When debugging my exe using Python I always get empty values for a,b
> and c (see below) allthough they are filled in correctly inside the
> exe (checked with a debugger).
> 
> Any idea what could be wrong?
> 
> Thanks,
> 
> Henk
> 
> import win32com.client
> 
> atm = win32com.client.Dispatch("ATM.Shell")
> b4 = atm.LogOn("Administrator", "EHSW", "Python")
> 
> 
> a=""
> b=""
> c=""
> HEMgr = atm.ATMHeadEndManager
> HEMgr.SetCodeTable("BS","ES","EE")
> HEMgr.GetCodeTable(a,b,c)
> print a
> print b
> print c
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list