🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15034

Re: Multiple Instances

#15034
From: Jonathan Arnold
Date: Tue, 22 Jul 2003 14:57
27 lines
1950 bytes
> How can I prevent a program from opening if one instance of it is 
> already running?

As is usual for BCB, there are several of ways:

1) Get a component to do the work.  The ZieglerCollection has a component that will
check for you: http://www.zieglersoft.com

2) Use a mutex to check for a previous instance. See Harold Howe's definitive
description of this method at:

http://www.bcbdev.com/faqs/faq74.htm

Or Alan Mill's at:

http://www.thebits.first-web.net/zips/onceonly.zip

3) Use a Mailslot, as per Robert Dunn's work at
http://home.att.net/~robertdunn/Yacs.html.

BCB5 has an example in the Examples\Controls\SingleInst folder.

-- 
Jonathan Arnold         C/C++/CBuilder Keen Advice:
http://www.keen.com/categories/categorylist_expand.asp?sid=5156620
    Comprehensive C++Builder link site:
http://www.buddydog.org/C++Builder/c++builder.html
Technical Details
Message-ID: <3f1d50c2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f1caa73$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f658915c3e85a35d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-22 08:11:42 PST
Date: Tue, 22 Jul 2003 10:57:07 -0400
From: Jonathan Arnold <jdarnold@buddydog.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en, ja
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Multiple Instances
References: <3f1caa73$1@newsgroups.borland.com>
In-Reply-To: <3f1caa73$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 66.92.76.225
Message-ID: <3f1d50c2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1058885826 66.92.76.225 (22 Jul 2003 07:57:06 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail