Open running processes

Discussion in 'Python' started by DeRRudi, Jun 28, 2005.

  1. DeRRudi

    DeRRudi Guest

    Hi all,

    I have a programm. In this program i've made the restriction that only
    one instance can run at the time. (done with mutex).
    Now i'd like it to open the running (make visible) instance when
    someone want's to open it a second time.
    Does anybody know how to do this? I hope you all understand what i
    mean. My English isn't to good...

    Greetz Rudi
    DeRRudi, Jun 28, 2005
    1. Advertisements

  2. DeRRudi

    DeRRudi Guest

    It is a wxWindow app. It is a kind of datamanager. it is possible to
    minimize it to the systray.

    hmm.. i've thought of an solution using memorymapping. see if it
    works.. don't know if it is the 'best' or 'safest' way.. but ok.


    ps. I'm always willing to learn! :D
    DeRRudi, Jun 28, 2005
    1. Advertisements

  3. DeRRudi

    DeRRudi Guest

    Well it doesnt work yet, but its gonna! ;)
    i've tested it with a little app. There is my main app (called it
    server) wich contains a thread. This thread listens to a mm (memory
    mapping) when an other program sets a flag
    (finished_producing_event.set() ) it just calls self.iconize(false)

    I'm not sure what pieces of code i have to post here.. posting all of
    it makes it too large i believe :)

    From server:

    ID_MESSAGECH = wxNewId()

    def EVT_RESULT(win, func):
    win.Connect(-1, -1, ID_MESSAGECH, func)

    class ResultEvent(wxPyEvent):

    def __init__(self):

    class listener(Thread):
    def __init__(self, frame):
    self.frame = frame

    self.stopped = False

    #shared_memory = mmap.mmap (0, common.SHARED_MEMORY_SIZE,
    #ready_to_consume_event = events.Win32Event
    #finished_producing_event = events.Win32Event

    def run(self):
    while not self.stopped:
    except Exception,e:
    print "Error: " , e

    def stop(self):
    self.stopped = True

    within the frame:
    listen = listener(self)

    EVT_RESULT(self, self.OnChange)

    def OnChange(self, event):
    tekstding = shared_memory.readline()
    if(tekstding.strip() ==
    elif(tekstding.strip() ==

    Hope you can see now how it works! Greetz
    DeRRudi, Jun 29, 2005
  4. DeRRudi

    DeRRudi Guest

    Well i want a external app to maximize and minimize my app.
    And later on i want the external one to send some data. Thought this
    would be the most easy (and fast) way!

    DeRRudi, Jun 30, 2005
  5. DeRRudi

    DeRRudi Guest

    Re: RE: Open running processes

    > Tim Goldenwrote:

    > Rudi. I, at least, am reading this via the mailing list, not
    > via Usenet nor via Google. This means that if you don't put
    > any kind of context in what you post, I have to guess at what
    > you're responding to. (All I see is the exact text you typed,
    > nothing else).
    > Assuming that you're answering my question: why use mmap and
    > not just two events? I understand what your overall plan is,
    > and it looks like you have a way to solve it. It just seemed
    > that you might be able to achieve the same thing with two
    > events: one for maximize and one for minimize. Why would
    > this be better? Well, only because it seems to me slightly simpler
    > than one event and a separate mmap mechanism. But I've never
    > done what you're doing, so I may well be completely wrong.
    > TJG

    Hi Tim,

    I'm sorry did not realize it!
    U are right! (i believe) at first i put in the minimize for testing.
    I'm only using the maximize.
    But it seemed handy to do it this way and beeing abled to send over
    data from an other programm. That's what i want to use the mmap for.
    Or am i missing something. because i'm not really seeing what your
    point is. Because it is a complete different process what is calling
    the maximize (or minimize) i can't just create an event and call it
    (or can i?)

    DeRRudi, Jun 30, 2005
  6. DeRRudi

    DeRRudi Guest

    Re: RE: RE: Open running processes

    > Tim Goldenwrote:

    > If you wanted to send over arbitrary data from another application,
    > then this is certainly a way to do it. (Another way might be to use

    > Windows pipe, for example). My point was only that if you are

    > an event as a wake-up call plus an atom of extra information saying

    > "max" or "min", and you weren't considering any expansion of this
    > vocabulary to include other commands, then two distinct events might

    > be simpler, one signalling "maximize", the other "minimize".
    > Please don't take this as any criticism of your work: there's no

    > right design decision here; I was merely curious as to the reasons
    > behind yours.
    > TJG

    Thanx for thinking with me! It really helps to have some other
    opinions! It might look simpeler to make two distinct events. But
    reading out the mm is really easy to do. So i didn't make more events
    for maximizing and minimizing. But further on i'm gonna use it. I
    think by now i have all the thing's i need to solute my problems.

    DeRRudi, Jun 30, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Divyang M
    Divyang M
    Feb 17, 2005
  2. Rusty Shackleford

    Worker Processes Running counter?

    Rusty Shackleford, Oct 5, 2005, in forum: ASP .Net
    Rusty Shackleford
    Oct 5, 2005
  3. rads
  4. Jeff Rodriguez
    David Schwartz
    Dec 9, 2003
  5. Marc Heiler
    Robert Klemme
    May 24, 2009

Share This Page