Basically, you must:
* Arrange for your process to be started
* In your process, create a COM server object - ie, create an object with
the _public_methods_ etc attributes, then use win32com.server.wrap to wrap
it
* Call pythoncom.RegisterActiveObject passing it this object.

That should be enough to have GetObject attach to your instance.

Mark

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of David Goodger
> Sent: Friday, 15 September 2006 6:22 AM
> To: python-win32@python.org
> Subject: Re: [python-win32] creating a long-running Python COM server
>
>
> I wrote:
> > 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>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to