Volucris volucris at
Mon Jul 2 22:15:26 CEST 2001

This is the code I used and it worked fine. Maybe you could post more code.

***Begin VB Code***

Private Sub Form_Load()
    Set PyObj = CreateObject("PythonComTest.TestClass")
    MsgBox PyObj.SomeMethod
End Sub

***End VB Code***

***Begin Python Code***

class PythonCOMTest:
    _public_methods_ = [ 'SomeMethod']
    _reg_progid_ = "PythonComTest.TestClass"
    _reg_clsid_ = "{41E24E95-D45A-11D2-852C-204C4F4F5020}"
    def SomeMethod(self):
        return "Hello!"

if __name__ == '__main__':
    print "Registering COM server..."
    import win32com.server.register

***End Python Code***


Volucris (a)
"Eu não falo uma única palavra do português."

"Mamoon Khan" <mamoonk at> wrote in message
news:mailman.994082583.16562.python-list at
> I am trying to create a ComServer .  Following is some part of the code
> you guys need to see if I am doing it right.
> _public_methods_ = [ 'SomeMethod']
> _reg_progid_ = "PythonComTest.TestClass"
> _reg_clsid_ = "{41E24E95-D45A-11D2-852C-204C4F4F5020}"
> Here the vb code that I am using
> Dim SomeServer as Variant
> Set SomeServer = CreateObject(PythonComTest.TestClass")
> msgbox SomeServer.SomeMethod()
> I can register the Com Server fine and can call it from within python
> createobject no problem.
> When I go to use it from VB I can create an object SomeServer fine but
> I call a method and return a string from a function and try to display the
> results in a message box, I get an error invalid type.
> Could someone tell me what the heck is going on here with this.
> Mamoon

More information about the Python-list mailing list