0001 # Class factory utilities. 0002 import pythoncom 0003 0004 def RegisterClassFactories(clsids, flags = None, clsctx = None): 0005 """Given a list of CLSID, create and register class factories. 0006 0007 Returns a list, which should be passed to RevokeClassFactories 0008 """ 0009 if flags is None: flags = pythoncom.REGCLS_MULTIPLEUSE|pythoncom.REGCLS_SUSPENDED 0010 if clsctx is None: clsctx = pythoncom.CLSCTX_LOCAL_SERVER 0011 ret = [] 0012 for clsid in clsids: 0013 # Some server append '-Embedding' etc 0014 if clsid[0] not in ['-', '/']: 0015 factory = pythoncom.MakePyFactory(clsid) 0016 regId = pythoncom.CoRegisterClassObject(clsid, factory, clsctx, flags) 0017 ret.append((factory, regId)) 0018 return ret 0019 0020 def RevokeClassFactories(infos): 0021 for factory, revokeId in infos: 0022 pythoncom.CoRevokeClassObject(revokeId) 0023
Generated by PyXR 0.9.4