Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/01/2011, 13:12
Avatar de Carlojas
Carlojas
 
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 10 meses
Puntos: 49
Respuesta: evitar abrir un sistema mas de una vez

Que tal Aquaventus, puedes utilizar algo como esto, el código esta en VB nada mas es que los pases a C#

Código vb:
Ver original
  1. 'Creas una funcion como esta
  2. Function PrevInstance() As Boolean
  3.  If UBound(System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
  4.     Return True
  5.     Application.DoEvents()
  6.  Else
  7.     Return False
  8.     Application.DoEvents()
  9.  End If
  10. End Function

Y en el evento Load de tu form principal haces la validación:
Código vb:
Ver original
  1. If PrevInstance() = True Then
  2. Application.DoEvents()
  3. MessageBox.Show("Ya Existe Una Instancia Abierta De La Aplicación", "Seguridad", MessageBoxButtons.OK, MessageBoxIcon.Warning)
  4. Application.Exit()
  5. End If


Saludos.
__________________
"SELECT * FROM Mujeres WHERE situacion NOT IN ('CASADAS','CON HIJOS','ATORMENTADAS','CUASI-ENNOVIADAS') AND personalidad <> 'INTENSA'"