K
kenchanningphd
Can someone post or point me to a fairly simple example where
a COM interface (other than the standard ones already exposed by the
win32com library) is implemented in python. I fear I am doing it
incorrectly.
Here is my example:
Suppose there is a COM interface "FOO" loaded in the windows registry
that has one method: add
Also suppose that COM object BAR has a method that expects a COM object
that implements FOO
-----------------------------------
import pythoncom
guid = pythoncom.CreateGuid()
class MyImplementation:
_public_methods_ = ["add"]
_reg_clsid_ = guid
_reg_progid_ = "MyImplementation"
_com_interfaces_ = [IID('{ID OF THE FOO INTERFACE}')]
def add(self,a,b):
print a + b
import win32com
win32com.server.register.UseCommandLine(MyImplementation)
MI = win32com.Dispatch("MyImplementation")
bar = win32com.Dispatch("BAR")
bar.somemethod(MI)
a COM interface (other than the standard ones already exposed by the
win32com library) is implemented in python. I fear I am doing it
incorrectly.
Here is my example:
Suppose there is a COM interface "FOO" loaded in the windows registry
that has one method: add
Also suppose that COM object BAR has a method that expects a COM object
that implements FOO
-----------------------------------
import pythoncom
guid = pythoncom.CreateGuid()
class MyImplementation:
_public_methods_ = ["add"]
_reg_clsid_ = guid
_reg_progid_ = "MyImplementation"
_com_interfaces_ = [IID('{ID OF THE FOO INTERFACE}')]
def add(self,a,b):
print a + b
import win32com
win32com.server.register.UseCommandLine(MyImplementation)
MI = win32com.Dispatch("MyImplementation")
bar = win32com.Dispatch("BAR")
bar.somemethod(MI)