Am 11.04.2012 09:59, schrieb Jan Wedel: > Hi, > > what ist he best way to keep-alive a COM server? The python application > does more stuff in the background that needs to keep running. I know I > can start the server without COM clients by using the "-embedding" > command line argument. However, as soon as the last COM client > disconnects, the server stops. > > I could just write a one-line COM dummy client that keeps at least one > connection open to the server but that would be an ugly way to solve the > problem. > > There are some C++ based COM server that register as a windows service > and I know that can be done with python as well. The question is if > comtypes supports keeping the server responsive to COM clients even if > no clients are connected at the moment? > > In the sources I found a Lock() method of LocalServer class in > "_comobject.py" but I don't know if this really helps and I couldn't > find any examples/test that show how to use it.
Yes, factory.LockServer(None, True) will add a lock that keeps the server running, factory.LockServer(None, False) will remove this lock again. http://msdn.microsoft.com/en-us/library/windows/desktop/ms682332%28v=vs.85%29.aspx Thomas ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users