如何将VB 6.0中的Application.PrevInstance转换为VB.NET?

oak*_*run 4 vb6 vb6-migration

我在VB 6代码中有'Applications.PrevInstance',我试图使用VS 2008升级到.NET.显然这段代码不再有效.有没有人对升级解决方案有任何想法?TIA

Rob*_*vey 7

看这里:

http://www.knowdotnet.com/articles/previnstance.html

Public Sub Main()
   If PrevInstance() Then Exit Sub

   ' continue with your application
   UserName = Environ("UserName")
   ComputerName = Environ("COMPUTERNAME")

End Sub

Function PrevInstance() As Boolean
  If UBound(Diagnostics.Process.GetProcessesByName _
     (Diagnostics.Process.GetCurrentProcess.ProcessName)) _
     > 0 Then
     Return True
  Else
     Return False
  End If
End Function
Run Code Online (Sandbox Code Playgroud)