Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #7886

Re: Prevent Multiple Instances

From "Craig Dawson" <craig_dawson@hotmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Prevent Multiple Instances
Date 2015-03-19 22:45 +1100
Organization A noiseless patient Spider
Message-ID <meecrr$3pc$1@dont-email.me> (permalink)
References <me9osc$d2h$1@dont-email.me>

Show all headers | View raw


Hi James,
I put the following at the start() of my app...
Works great!
Regards, Craig.

IF AlreadyRunning( "PNS.EXE" ) // Nice!
    oAppWin := AppWindow{}
    ErrorBox{oAppWin, "You can't launch this program twice at the same 
time!"}:Show()
    BREAK // STOP
ENDIF

FUNCTION AlreadyRunning( cID_APP AS STRING ) AS LOGIC
// Author : Richard Press (with lots of help)
CreateMutex(NULL,TRUE,String2Psz(cID_APP))
RETURN (GetLastError()==ERROR_ALREADY_EXISTS)



"James Martin" <james@northwoodlumber.com> wrote in message 
news:me9osc$d2h$1@dont-email.me...
>I would like to know a simple way to prevent an app from running twice that 
>avoids the problem of leaving a flag that prevents any further execution 
>when the program terminates with an error.
>
> James 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Prevent Multiple Instances James Martin <james@northwoodlumber.com> - 2015-03-17 13:44 -0400
  Re: Prevent Multiple Instances JohnMartens <martens@tennishulp.info> - 2015-03-17 18:55 +0100
  Re: Prevent Multiple Instances "Craig Dawson" <craig_dawson@hotmail.com> - 2015-03-19 22:45 +1100
    Re: Prevent Multiple Instances James Martin <james@northwoodlumber.com> - 2015-03-19 08:33 -0400

csiph-web