Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Feb : Using mutexs to prevent the running of more than one instance of the program

www.cryer.info
Managed Newsgroup Archive

Using mutexs to prevent the running of more than one instance of the program

Subject:Using mutexs to prevent the running of more than one instance of the program
Posted by:"Al Christoph" (a..@too.net)
Date:Fri, 18 Feb 2005 12:40:57

1. I am running Win XP SP2 with Delphi 7.

2. There are numerous fine examples of using a mutex to stop multiple
instances of a program running.

They all have something like the following;

  mutex := CreateMutex(nil, True, UniqueAppName);
  if GetLastError = ERROR_ALREADY_EXISTS ...

I've tried such stuff and the mutex always gets created and GetLastError is
always 0.

I test by compiling, starting program outside delphi, and then running in
IDE so I can watch what happens.

What am I doing that is screwy?

Regards,
Al

Replies:

www.cryer.info
Managed Newsgroup Archive