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.

util.py 1.0KB

12345678910111213141516171819202122232425262728293031323334
  1. """General utility functions common to client and server.
  2. This module contains a collection of general purpose utility functions.
  3. """
  4. import pythoncom
  5. import win32api
  6. import win32con
  7. def IIDToInterfaceName(iid):
  8. """Converts an IID to a string interface name.
  9. Used primarily for debugging purposes, this allows a cryptic IID to
  10. be converted to a useful string name. This will firstly look for interfaces
  11. known (ie, registered) by pythoncom. If not known, it will look in the
  12. registry for a registered interface.
  13. iid -- An IID object.
  14. Result -- Always a string - either an interface name, or '<Unregistered interface>'
  15. """
  16. try:
  17. return pythoncom.ServerInterfaces[iid]
  18. except KeyError:
  19. try:
  20. try:
  21. return win32api.RegQueryValue(
  22. win32con.HKEY_CLASSES_ROOT, "Interface\\%s" % iid
  23. )
  24. except win32api.error:
  25. pass
  26. except ImportError:
  27. pass
  28. return str(iid)