Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

factory.py 850B

1 year ago
1234567891011121314151617181920212223242526
  1. # Class factory utilities.
  2. import pythoncom
  3. def RegisterClassFactories(clsids, flags=None, clsctx=None):
  4. """Given a list of CLSID, create and register class factories.
  5. Returns a list, which should be passed to RevokeClassFactories
  6. """
  7. if flags is None:
  8. flags = pythoncom.REGCLS_MULTIPLEUSE | pythoncom.REGCLS_SUSPENDED
  9. if clsctx is None:
  10. clsctx = pythoncom.CLSCTX_LOCAL_SERVER
  11. ret = []
  12. for clsid in clsids:
  13. # Some server append '-Embedding' etc
  14. if clsid[0] not in ["-", "/"]:
  15. factory = pythoncom.MakePyFactory(clsid)
  16. regId = pythoncom.CoRegisterClassObject(clsid, factory, clsctx, flags)
  17. ret.append((factory, regId))
  18. return ret
  19. def RevokeClassFactories(infos):
  20. for factory, revokeId in infos:
  21. pythoncom.CoRevokeClassObject(revokeId)