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


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

Re: Prevent Multiple Instances

Path csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From "Craig Dawson" <craig_dawson@hotmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Prevent Multiple Instances
Date Thu, 19 Mar 2015 22:45:45 +1100
Organization A noiseless patient Spider
Lines 28
Message-ID <meecrr$3pc$1@dont-email.me> (permalink)
References <me9osc$d2h$1@dont-email.me>
Reply-To "Craig Dawson" <craig_dawson@hotmail.com>
Injection-Date Thu, 19 Mar 2015 11:44:59 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="0d98b2fb791be9e1b4da90c7fd524bc1"; logging-data="3884"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zdHN93QxDLadJORZILNm+BV0xlGmw1Xc="
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-RFC2646 Format=Flowed; Response
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
Cancel-Lock sha1:oGc00WxszaPUsAW1s5095tKLWxs=
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.lang.clipper.visual-objects:7886

Show key headers only | 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