App.Previnstance Equivalent

  

        Dim appName As String = Process.GetCurrentProcess.ProcessName



        Dim sameProcessTotal As Integer = Process.GetProcessesByName(appName).Length



        If sameProcessTotal > 1 Then



            MessageBox.Show("A previous instance of this application is already open!", " App.PreInstance Detected!", MessageBoxButtons.OK, MessageBoxIcon.Information)



            Me.Close()



        End If



        appName = Nothing



        sameProcessTotal = Nothing

你可能感兴趣的:(String,Integer,application)