[python-win32] creating a long-running Python COM server
goodger at python.org
Thu Sep 14 22:22:13 CEST 2006
> I'm trying to figure out how to create a COM server as part of a
> Python GUI app, such that an Excel client can connect to the *already
> running* instance of the server in the app. IOW, I want Excel to talk
> to the existing Python process, and not start a new one.
This may clarify my issue. I found this in the VB help:
' Test to see if there is a copy of Microsoft Excel already running.
On Error Resume Next
' Getobject function called without the first argument returns a
' reference to an instance of the application. If the application isn't
' running, an error occurs.
Set MyXL = Getobject(, "Excel.Application")
If Err.Number <> 0 Then ExcelWasNotRunning = True
I'd like to do the same thing with my app. How can I register the COM
server and/or tell Windows that my application is now running so that
I get the same behavior as the above? I don't want an instance of my
server class created in a new Python process; I want the existing,
running Python process.
David Goodger <http://python.net/~goodger>
More information about the Python-win32