🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2932

Re: How to avoid multiple instances of a program in NT and 95?

#2932
From: Amol Deshpande
Date: Wed, 05 Feb 1997 00:00
44 lines
2133 bytes
In article <5da29d$bs$2@newsserver.rrzn.uni-hannover.de>, 
h.eichmann@mbox.iqo.uni-hannover.de says...
>
>raymondc@microsoft.com.--- (Raymond Chen) wrote:
>
>
>>This still won't work if a second instance is started before the
>>first gets a chance to create its window.
>
>>Create a named event and check if you get ERROR_ALREADY_EXISTS
>>from GetLastError.
>
>Hi!
>
>What happens if the program crashes before it can release the event?
>It is improbably also possible that a different program uses the same 
>name for an event.

If the program crashes (terminates), the event is released.

>
>What about this:
>
>Open your own EXE file for read access and do not allow other
>tasks to open the file. If this fails someone als has a lock on
>this file and another instance is still running.
>
>Yours
>
>
>Heiner Eichmann
>Inst. of Quantum Optics
>University of Hanover, Germany
>h.eichmann@mbox.iqo.uni-hannover.de
>

But then I could always copy the .exe to a different name and run another
instance. 

-amol
-- 
The opinions expressed in this message are my own personal views 
and do not reflect the official views of Microsoft Corporation.
Technical Details
Message-ID: <5dad90$hsc@news.microsoft.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <5d4eeb$n6u$1@euler.space.net> <aFwHpCAU3e9yEwa8@ormesci.demon.co.uk> <32f7e6e5.422962@157.55.96.156> <5da29d$bs$2@newsserver.rrzn.uni-hannover.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1124cf,3403ef0501dd273
X-Google-Attributes: gid1124cf,public
X-Google-Thread: 113dfb,3403ef0501dd273
X-Google-Attributes: gid113dfb,public
X-Google-Thread: 105df1,3403ef0501dd273
X-Google-Attributes: gid105df1,public
X-Google-Thread: f6ef4,3403ef0501dd273
X-Google-Attributes: gidf6ef4,public
From: amold@microsoft.com (Amol Deshpande)
Subject: Re: How to avoid multiple instances of a program in NT and 95?
Date: 1997/02/05
Message-ID: <5dad90$hsc@news.microsoft.com>
X-Deja-AN: 214640327
references: <5d4eeb$n6u$1@euler.space.net> <aFwHpCAU3e9yEwa8@ormesci.demon.co.uk> <32f7e6e5.422962@157.55.96.156> <5da29d$bs$2@newsserver.rrzn.uni-hannover.de>
organization: Microsoft Corporation
mime-version: 1.0
reply-to: nospam@my.mbox
newsgroups: comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.win32,de.comp.os.ms-windows.programmer,fido.ger.windows.prog