IDL help?
Dave Gustafson
DGustafson at attbi.com
Fri Sep 20 13:22:36 EDT 2002
I'm still trying to get a COM server written in Python to be accessable from
.NET.
So far, I understand that I need to create a .idl file for the server and
compile that using MIDL to a .tlb type library so that the COM server can be
registered. I *think* that the insides of this .idl file actually needs to
use the ODL syntax? I've tried inspecting the type definitions exposed by
the ITypeInfo Viewer in the OLE/COM Object Viewer for a COM executable, but
am having a hard time translating the interface definitions into something I
can use for my Python library.
Can anyone help by pointing me to a Python based COM server that works so
that I could install it and inspect the type info as an example? Or could
someone help with the syntax required to create the .idl for a simple
example like the one in Mark H's book... (included below...)
# SimpleCOMServer.py - A sample COM server - almost as small as they come!
#
# We simply expose a single method in a Python COM object.
class PythonUtilities:
_public_methods_ = [ 'SplitString' ]
_reg_progid_ = "PythonDemos.Utilities"
# NEVER copy the following ID
# Use "print pythoncom.CreateGuid()" to make a new one.
_reg_clsid_ = "{65C3A684-9077-4911-A58D-833A85B8C096}"
def SplitString(self, val, item=None):
import string
if item != None: item = str(item)
return string.split(str(val), item)
# Add code so that when this script is run by
# Python.exe, it self-registers.
if __name__=='__main__':
print "Registering COM server..."
import win32com.server.register
win32com.server.register.UseCommandLine(PythonUtilities)
Thanks in advance!
Regards,
Dave
More information about the Python-list
mailing list