全局代码
NetChoice
Public _stopThread As Boolean
Public Sub beforeOpenProject()
Do Until ShowAppWindow("网络类型", 1) = True
If _stopThread Then Exit Do
application.DoEvents
Loop
End Sub
Default
Public mu As System.Threading.Mutex \'控制程序不能重复打开
BeforeOpenProject
\'---控制一台电脑只能打开一个客户端运行!
Dim sucess As
Boolean = False
mu = new
System.Threading.Mutex(True, "dsdfhdfghf", sucess)
If not sucess Then
MessageBox.Show("程序已经在运行,不能重复打开!",
"提示",MessageBoxButtons.Ok,MessageBoxIcon.Warning,0,
System.Windows.forms.MessageBoxOptions.ServiceNotification)
e.Cancel = True
End If
\'---第一次打开项目时先显示网络类型对话框
Dim t1 As New
System.Threading.Thread(AddressOf beforeOpenProject)
t1.IsBackground =
True
t1.Start()
AfterOpenProject
_stopThread = True
\'停止线程