Ver Mensaje Individual
  #1  
Antiguo 04-06-2005
Avatar de Koder
Koder Koder is offline
Miembro
 
Registrado: may 2005
Posts: 14
Reputación: 0
Koder Va por buen camino
Smile Utilizando Semáforos

Hola novaten

Hay varias formas de solucionar ese problema, esta es la que más me ha gustado

En el uses de la fuente de tu aplicación debes incluir Windows y poner algo así más o menos

Código:
  
procedure No_Repetir_Applicacion;
var
  hSemaphore: THandle;
begin
  hSemaphore := CreateSemaphore(nil, 0, 1, 'My Aplication Name')
  if (hSemaphore <> 0) and GetLastError = (ERROR_ALREADY_EXISTS) then
  begin
	{Aqui pones lo que quieres que haga antes de terminar
	por ejemplo, mostrar un mensaje 
	o llamar la aplicación que se está ejecutando}
	CloseHandle(hSemaphore);
	Halt;
  end;
end;
 
begin
  No_Repetir_Applicacion;
  Application.Initialize;
  ...  
  Application.Run;
end.
Espero te sea util.

Koder
__________________
"First they ignore you. Then they laugh at you. Then they fight you. Then you win."
Mohandas Gandhi
Responder Con Cita