当不应用程序框架时,可以通过定义互斥变量来判断是否已运行实例:
Sub Main() Dim isNotRunning As Boolean = True Static run As New System.Threading.Mutex(True,"SampleForm",isNotRunning) If isNotRunning Then run.ReleaseMutex() Application.Run(New SampleForm) End If End Sub将SampleForm替换为要运行的窗体即可。 原文链接:https://www.f2er.com/vb/259181.html