embedded Python calling app via COM

Roger Upole rupole at hotmail.com
Thu Jun 22 23:36:00 EDT 2006


"Jim" <jim at trainplayer.com> wrote in message news:1150887820.604214.276880 at i40g2000cwc.googlegroups.com...
>I have a C++ app which fires up a Python script using C API calls.
> That script operates the app via Automation calls, like this:
>
> from win32com.client import *
> from mywrapper import *
>
> myapp = Application()
> myapp.Visible = True
> mydoc = myapp.Documents.Open(...)
>
> My problem is to make sure the instance of myapp is the same one I am
> calling from.  The above code starts up a new instance of the app,
> which is not what I want.  In other words I need something like a
> GetObject instead of a CreateObject, and I need some way to identify
> the calling app so I can tell GetObject about it.
>
> Before I go and do something hack, I thought I'd see if anyone else is
> in this situation and knows a good way to do the job.
>
>  -- Jim

Pythoncom.GetActiveObject will retrieve the running instance of the app.
(assuming that it registers itself in the Running Object Table)

    Roger





----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



More information about the Python-list mailing list