Re: Prevent to exec second copy of application



On Sat, 2004-11-13 at 14:41 +0300, jakonda jakarta wrote:
Helo, I try to force my application to be only one on display,
I mean if somebody do

$./my-program
OK!
$./my-program
There is another copy. Use it

I know that on Windows you can stop using multiple instances of an
application by creating a Mutex:

        HANDLE mutex = NULL;
        mutex = CreateMutex (FALSE, NULL, "My App Name");

When you quit, you then need to release it:

        ReleaseMutex (mutex);

Also, when you go to install your app, if you happen to be using Inno,
you can use the following:

        [setup]
        AppMutex=My App Name

To make sure it doesn't un/install whilst running.

-- 
Regards,
Martyn



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]