我在VB 6代码中有’Applications.PrevInstance’,我试图使用VS 2008升级到.NET.显然这段代码不再有效.有没有人对升级解决方案有任何想法? TIA 看这里: http://www.knowdotnet.com/articles/previnstance.ht
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