1. Limit One Copy
- Posted by Christopher B <president at insight-concepts.com> Jun 30, 2002
- 410 views
Hi All, Does anyone know how to limit one copy of a program to run under= Windows? Thank you, Chris
2. Re: Limit One Copy
- Posted by Wolf <wolfritz at KING.IGS.NET> Jun 30, 2002
- 408 views
-- allow only one instance of this program object jk constant zCreateSemaphore = registerw32Function(kernel32,"CreateSemaphoreA", {C_POINTER,C_INT,C_INT,C_POINTER},C_INT), zGetLastError = registerw32Function(kernel32,"GetLastError",{},C_INT), zERROR_ALREADY_EXISTS = 183 -- create a semaphore for this instance jk = w32Func(zCreateSemaphore,{NULL, 0, 1, allocate_string("just_once")}) jk = w32Func(zGetLastError,{}) if jk = zERROR_ALREADY_EXISTS then abort(0) -- abort if we're already running ! end if > Does anyone know how to limit one copy of a program to run under Windows?
3. Re: Limit One Copy
- Posted by Christopher B <president at insight-concepts.com> Jun 30, 2002
- 423 views
Thank you Wolf, your code did the trick. Chris > >-- allow only one instance of this program >object jk >constant >zCreateSemaphore =3D= registerw32Function(kernel32,"CreateSemaphoreA", >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0{C_POINTER,C_INT,C_INT,C_POINTER},C_INT), >zGetLastError =3D >registerw32Function(kernel32,"GetLastError",{},C_INT), >zERROR_ALREADY_EXISTS =3D 183 >-- create a semaphore for this instance >jk =3D w32Func(zCreateSemaphore,{NULL, 0, 1, >allocate_string("just_once")}) >jk =3D w32Func(zGetLastError,{}) >if jk =3D zERROR_ALREADY_EXISTS then >=A0abort(0) -- abort if we're already running ! >end if > >>=A0Does anyone know how to limit one copy of a program to run= under >>Windows? > > > > --