Attribute VB_Name = "Lan"
Public Declare Function CreateMutex Lib "Kernel32" Alias "CreateMutexA" (lpMutexAttributes As Any, ByVal bInitialOwner As Long, ByVal lpName As String) As Long
Public Declare Function ReleaseMutex Lib "Kernel32" (ByVal hMutex As Long) As Long
Public Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long) As Long
Public WsNet As New IWshNetwork_Class
Public MiNombreEXE As String, l As String
Public Fso As New FileSystemObject
Public DirSystem As String, DirWin As String
Public mut As String
Const ERROR_ALREADY_EXISTS = 183&
Public Function PrevInstance(StrPreviasure As String) As Boolean
Dim Ret As String
    Ret = CreateMutex(0&, 1, StrPreviasure) '   //  Creamos y obtenemos el handle
    PrevInstance = CBool(Err.LastDllError = ERROR_ALREADY_EXISTS)
    If PrevInstance Then
        ReleaseMutex Ret    '   //  Liberamos el Handle
        CloseHandle Ret     '   //  Cerramos el Handle
    End If
End Function
