Re: Limit One Copy

new topic     » goto parent     » topic index » view thread      » older message » newer message

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?
>
>
>
>


--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu