Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form
<STAThread()> Shared Sub Main(ByVal CmdArgs() As String)
Dim createdNew As Boolean
Dim m As New Mutex(True, "test", createdNew)
If createdNew Then
System.Windows.Forms.Application.Run(New Form1())
m.ReleaseMutex()
Else
MessageBox.Show("本程序只允许同时运行一个")
End If
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
<STAThread()> Shared Sub Main(ByVal CmdArgs() As String)
Dim createdNew As Boolean
Dim m As New Mutex(True, "test", createdNew)
If createdNew Then
System.Windows.Forms.Application.Run(New Form1())
m.ReleaseMutex()
Else
MessageBox.Show("本程序只允许同时运行一个")
End If
End Sub
End Class
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |