We pass REGCLS_MULTIPLEUSE as the flag for an out-of-proc server. This
worked fine on Windows 7, but Windows 8 seems to ignore this flag and
attempts to launch a new instance for any call other than the first.

I tested this with the sample code given
here<http://starship.python.net/crew/theller/comtypes/server.html>
with
only a slight modification, changing the server so that it stays running
and continually processes calls, to emulate what our program does.

                while True:
                    comtypes.server.localserver.run([MyObjectImpl])

On Win7, if you launch the server, you can run the client multiple times
and the calls will always go to the running instance of the server. On
Win8, the first client call behaves as expected, but all subsequent calls
cause a new instance of the server to be launched, and CreateObject
eventually fails with the following error:

Creating MyObject object now!
Traceback (most recent call last):
  File "tools\sample_com_obj\sample_client.py", line 13, in <module>
    x = CreateObject("MyTypelib.MyObject")
  File "\comtypes\client\__init__.py", line 235, in CreateObject
    obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx,
interface=interface)
  File "\comtypes\__init__.py", line 1145, in CoCreateInstance
    _ole32.CoCreateInstance(byref(clsid), punkouter, clsctx, byref(iid),
byref(p))
  File "_ctypes/callproc.c", line 936, in GetResult
WindowsError: [Error -2146959355] Server execution failed

(That error number is 0x80080005 for marginally more readability)

Both server and client files attached for your reference.

Is anyone else experiencing this? Am I doing something horribly wrong?

--Alicia

Attachment: server.py
Description: Binary data

Attachment: client.py
Description: Binary data

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to