how to use python com server in c++?

L

Leo Jay

dear all,
i have a python com server like this:

import win32com.server.register

class HelloWorld:
_reg_clsid_ = "{B0EB5AAB-0465-4D54-9CF9-04ADF7F73E4E}"
_reg_desc_ = 'Python test com server'
_reg_progid_ = "Leojay.ComServer"
_public_methods_ = ['Add', 'Mul']

def Add(self, a, b):
return a+b
def Mul(self, a, b):
return a*b


if __name__ == '__main__':
win32com.server.register.UseCommandLine(HelloWorld)


after registering the com server, i can use it in visual basic .net:
Dim a As Integer = 5
Dim b As Integer = 8
Dim h As Object = CreateObject("Leojay.ComServer")
MsgBox(h.Add(a, b).ToString() + " " + h.Mul(a, b).ToString())

but i don't know how to use it in visual c++.

who has any idea about using this com server in viusal c++?
a detailed sample of early binding would be better, thanks.
 
B

Butternut Squash

Leo said:
dear all,
i have a python com server like this:

import win32com.server.register

class HelloWorld:
_reg_clsid_ = "{B0EB5AAB-0465-4D54-9CF9-04ADF7F73E4E}"
_reg_desc_ = 'Python test com server'
_reg_progid_ = "Leojay.ComServer"
_public_methods_ = ['Add', 'Mul']

def Add(self, a, b):
return a+b
def Mul(self, a, b):
return a*b


if __name__ == '__main__':
win32com.server.register.UseCommandLine(HelloWorld)


after registering the com server, i can use it in visual basic .net:
Dim a As Integer = 5
Dim b As Integer = 8
Dim h As Object = CreateObject("Leojay.ComServer")
MsgBox(h.Add(a, b).ToString() + " " + h.Mul(a, b).ToString())

but i don't know how to use it in visual c++.

who has any idea about using this com server in viusal c++?
a detailed sample of early binding would be better, thanks.

too complicated for my brain. Waiting for a good answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top