python Com接口测试

时间:2021-12-11 17:14:00
import comtypes.client as cc
import comtypes
tlb_id = comtypes.GUID("{D85C6069-D628-4276-93C3-9A94E5338D8B}")
cc.GetModule((tlb_id, 1, 0))

import comtypes.gen.WSCustomerServicePlatform as TaskLib

class IEventSink:
    def OnNotify(self,NotifyCode,OleVariant1,OleVariant2):
        print ("NotifyCode event. name = %s" % NotifyCode)

task_launcher = cc.CreateObject("WSCustomerServicePlatform.CustomerService", None, None, TaskLib.ICustomerService)
task_reg = cc.CreateObject("WSCustomerServicePlatform.CustomerService", None, None, TaskLib.IRegister)
sink = IEventSink()
advise = cc.GetEvents(task_reg, sink)
notify = None
t=task_launcher.Start(1042,'1.6.1.0',notify)
x=task_reg.AntiEmailBreaker(1042,'1.6.1.0',"wangjs1@wondershare.cn",'English',1)
print(x)
# cc.PumpEvents(5)

advise = None
task_launcher = None
task_reg = None

python Com接口测试