Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/11/2010, 10:36
Avatar de cobossagrav
cobossagrav
 
Fecha de Ingreso: junio-2009
Ubicación: Cusco - Perú
Mensajes: 414
Antigüedad: 14 años, 11 meses
Puntos: 1
Sonrisa Respuesta: Formularios Repetidos - Visual Basic 2005

Me fui a Navegar por donde me dijiste amigo:

el codigo es el siguiente:

Cita:
static void Main(string[] args)
{
Mutex _mut = null;

try
{
_mut = Mutex.OpenExisting(AppDomain.CurrentDomain.Friendl yName);
}
catch
{
//handler to be written
}

if (_mut == null)
{
_mut = new Mutex(false, AppDomain.CurrentDomain.FriendlyName);
}
else
{
_mut.Close();
MessageBox.Show("Instance already running");

}
}
Pero claro halli esta en C#

asi que me puse manos a la obra y trate de Traducirlo al VB2005

Logrando interpretarlo de la siguiente manera:

Cita:
Public Class ClsUnico
Public Overloads Shared Sub Main()
Main(System.Environment.GetCommandLineArgs())
End Sub

Private Shared Mut As New Mutex()

Overloads Shared Sub Main(ByVal args() As String)
Mut.ReleaseMutex()
Try
Mut = Mutex.OpenExisting(AppDomain.CurrentDomain.Friendl yName)
Catch ex As Exception

End Try
If Mut = null Then
Mut = New Mutex(False, AppDomain.CurrentDomain.FriendlyName)
Else
Mut.Close()
MsgBox("Instance already running")
End If
End Sub
End Class
pero tengo un problema en la comparación
al usar el If

en la parte Mut = null

no lo identifica, no se logra determinar mi variable como null para realizar la condición...

espero me puedan ayudar...
__________________
Saludos y Gracias.