Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #210
| Subject | Re: As it's launched, how can a program test if a copy of itself is already running ? |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| From | Alan Adams <alan@adamshome.org.uk> |
| Date | 2011-04-25 12:29 +0100 |
| Message-ID | <1f0771c951.Alan.Adams@laptop.adamshome.org.uk> (permalink) |
| References | <9c9556c5-8dd0-498a-b6f5-6aa531f4be63@d28g2000yqf.googlegroups.com> <c2f1bcd8-56dc-4422-a744-1c24bbcdd8c8@l36g2000vbp.googlegroups.com> <51c90e63f1News03@avisoft.f9.co.uk> |
| Organization | Orpheus Internet Services |
In message <51c90e63f1News03@avisoft.f9.co.uk>
Martin <News03@avisoft.f9.co.uk> wrote:
> On 24 Apr, in article
> <c2f1bcd8-56dc-4422-a744-1c24bbcdd8c8@l36g2000vbp.googlegroups.com>,
> Gazza <usenet@garethlock.com> wrote:
>> On Apr 4, 8:37 am, Martin Hansen <m...@shrewsbury.org.uk> wrote:
>>> Dear All,
>>> Let us suppose that program X is running on the desktop.
>>> If a second copy of X is now launched, I'd like it to know that it is
>>> the second copy.
>>> I suspect that there is an easy way of doing this.
>>> Program X is in BBC BASIC, so any code fragments in that language,
>>> please.
<snip>
I have a similar check although its purpose is to prevent multiple
copies. Code follows.
DEF FNstartwimpcheck(name$, neededversion%)
LOCAL h%
h%=FNfindtask(name$)
IF h%=0 THEN
PROCstartwimp(name$,neededversion%)
=TRUE
ELSE
IF DEBUG% THEN *report name$ is already running - cannot start
another copy
=FALSE
ENDIF
REM =========================================== FIND TASK
DEF FNfindtask(name$)
LOCAL ptr%,taskid%,handle%,I%,A$,name%
ptr%=0
taskid%=0
REPEAT
SYS "TaskManager_EnumerateTasks",taskid%,wlib_block%,16 TO
taskid%,ptr%
handle%=!wlib_block%
name%=wlib_block%!4
I%=0
A$=""
WHILE ( I%<256 ) AND ( (name%?I%) >= 32 )
A$+=CHR$(name%?I%)
I%+=1
ENDWHILE
UNTIL taskid%<0 OR A$=name$
IF A$=name$ THEN =handle% ELSE =0
--
Alan Adams, from Northamptonshire
alan@adamshome.org.uk
http://www.nckc.org.uk/
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
As it's launched, how can a program test if a copy of itself is already running ? Martin Hansen <mhh@shrewsbury.org.uk> - 2011-04-04 00:37 -0700
Re: As it's launched, how can a program test if a copy of itself is already running ? "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-04-04 09:59 +0200
Re: As it's launched, how can a program test if a copy of itself is already running ? James Lampard <dontreplytothis@mailinator.com> - 2011-04-04 01:39 -0700
Re: As it's launched, how can a program test if a copy of itself is already running ? Dave Higton <davehigton@dsl.pipex.com> - 2011-04-04 20:35 +0100
Re: As it's launched, how can a program test if a copy of itself is already running ? Martin Hansen <mhh@shrewsbury.org.uk> - 2011-04-05 12:13 -0700
Re: As it's launched, how can a program test if a copy of itself is already running ? Martin Hansen <mhh@shrewsbury.org.uk> - 2011-04-07 09:47 -0700
Re: As it's launched, how can a program test if a copy of itself is already running ? Gazza <usenet@garethlock.com> - 2011-04-24 02:58 -0700
Re: As it's launched, how can a program test if a copy of itself is already running ? Martin <News03@avisoft.f9.co.uk> - 2011-04-24 18:32 +0100
Re: As it's launched, how can a program test if a copy of itself is already running ? "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-04-24 20:35 +0200
Re: As it's launched, how can a program test if a copy of itself is already running ? Alan Adams <alan@adamshome.org.uk> - 2011-04-25 12:29 +0100
Re: As it's launched, how can a program test if a copy of itself is already running ? Steve Drain <steve@kappa.me.uk> - 2011-05-05 13:01 +0100
Re: As it's launched, how can a program test if a copy of itself is already running ? Martin Wuerthner <spamtrap@mw-software.com> - 2011-05-05 15:51 +0200
Re: As it's launched, how can a program test if a copy of itself is already running ? Steve Drain <steve@kappa.me.uk> - 2011-05-05 16:37 +0100
Re: As it's launched, how can a program test if a copy of itself is already running ? Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-05-06 00:32 +0200
Re: As it's launched, how can a program test if a copy of itself is Howard Dawson <hsdawson@ormail.co.uk> - 2011-05-17 20:35 +0100
csiph-web