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.

localserver.py 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # LocalServer .EXE support for Python.
  2. #
  3. # This is designed to be used as a _script_ file by pythonw.exe
  4. #
  5. # In some cases, you could also use Python.exe, which will create
  6. # a console window useful for debugging.
  7. #
  8. # NOTE: When NOT running in any sort of debugging mode,
  9. # 'print' statements may fail, as sys.stdout is not valid!!!
  10. #
  11. # Usage:
  12. # wpython.exe LocalServer.py clsid [, clsid]
  13. import sys
  14. sys.coinit_flags = 2
  15. import pythoncom
  16. import win32api
  17. from win32com.server import factory
  18. usage = """\
  19. Invalid command line arguments
  20. This program provides LocalServer COM support
  21. for Python COM objects.
  22. It is typically run automatically by COM, passing as arguments
  23. The ProgID or CLSID of the Python Server(s) to be hosted
  24. """
  25. def serve(clsids):
  26. infos = factory.RegisterClassFactories(clsids)
  27. pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
  28. pythoncom.CoResumeClassObjects()
  29. pythoncom.PumpMessages()
  30. factory.RevokeClassFactories(infos)
  31. pythoncom.CoUninitialize()
  32. def main():
  33. if len(sys.argv) == 1:
  34. win32api.MessageBox(0, usage, "Python COM Server")
  35. sys.exit(1)
  36. serve(sys.argv[1:])
  37. if __name__ == "__main__":
  38. main()