🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Stopping multiple instances of an application

#12016
From: Michel Leunen
Date: Tue, 06 Jan 2004 17:05
27 lines
1957 bytes
Andrew wrote:

> I am trying to stop more than one instance of my app running at any one
> time, normally I use a mutex and this works fine, most of the applications
> we have developed have used Win 9x but now we have moved to win 2k and the
> mutex doesn't seem to work any more, I have also tried semaphores and the
> API function FindWindow, please see the following
> 
> Using a mutex:

>         mutex = OpenMutex(NULL,false,mutexname.c_str());

mutex = OpenMutex(MUTEX_ALL_ACCESS,false,mutexname.c_str());

If it fails OpenMutex yields NULL indicating either that a non-existing 
mutex or an error when calling the function. I don't think you can use 
NULL for the dwDesiredAccess parameter.
It works at least for me with XP.

Michel
-- 
----------------------------------------
Michel Leunen
mailto:michel@leunen.com
C++Builder, C++BuilderX, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Technical Details
Message-ID: <3ffaeafe@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ffae3bc@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,557b0e7a5128b725
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-06 09:10:04 PST
Date: Tue, 06 Jan 2004 18:05:46 +0100
From: Michel Leunen <mleu@STOPSPAMskynet.be>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Stopping multiple instances of an application
References: <3ffae3bc@newsgroups.borland.com>
In-Reply-To: <3ffae3bc@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 217.136.247.22
Message-ID: <3ffaeafe@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1073408766 217.136.247.22 (6 Jan 2004 09:06:06 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail