Error connecting to COMServer

Mike Müller mmueller at dgfz.de
Mon Jun 11 04:26:22 EDT 2001


Stefan Migowsky <smigowsky at dspace.de> wrote in message news:<mailman.992242456.13541.python-list at python.org>...
> As you see from the makepy code the ProgId you must use is
> "Adder.AddingMachine.1.0". The developer of the COM server
> seems not to give a version independent Prog ID. 
> 
> So you should use : 
> >>>from win32com.client import Dispatch
> >>>a = Dispatch("Adder.AddingMachine.1.0")
> 
>
 
Changing the interface in the wizard to "dual interface" (IUnkown and
IDispatch) does the trick. Now it works as expected.
 
>>> from win32com.client import Dispatch
>>> a = Dispatch("Adder.AddingMachine")
>>> a
<COMObject Adder.AddingMachine>
>>> a.GetValue()
0.0
>>> a.Add(20)
>>> a.GetValue()
20.0
>>> a.Clear()
>>> a.GetValue()
0.0


Before obviously only the IUnkown interface was created. (-> Don't
blindly follow all the instruction of a wizard for creating a toy
example.)
 
Thanks again.
 
Mike



More information about the Python-list mailing list