Subj : Re: Prevent loading multiple instances of program To : borland.public.cpp.borlandcpp From : "Regis St-Gelais" Date : Tue Dec 16 2003 08:53 am This works in win 9x , win2k and win XP It create a mutex if this is the first instance. Replace the mutex name by someting unic. bool MyAppAlreadyRunning(void) { HANDLE hMutex = NULL; hMutex = CreateMutex(NULL,true,_T("MyAppRunningMutex")); if (GetLastError() == ERROR_ALREADY_EXISTS ) { CloseHandle(hMutex); return(true); // Already running } return(false); // First instance } -- Regis St-Gelais, P. Eng. / ing. Software Development / Développement informatique www.laubrass.com -- "C. Chris Rogers" a écrit dans le message de news:3fde6a09$1@newsgroups.borland.com... > How can I prevent loading multiple instances of a program in the Windows > 2000 environment? The book, "C++ Builder How-T0", describes a method > that uses a mutex, and it works with Windows 98, but not Windows 2000. > Please help. > Thanx > CR > .