以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]项目启动  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=84602)

--  作者:zcgmxf
--  发布时间:2016/5/5 15:29:00
--  [求助]项目启动
老师,论坛里有禁止打开两个相同项目的帖子,是否可用?
If System.Diagnostics.Process.GetProcessesByName( "项目名称").Length > 0 Then 
    msgbox("禁止打开多个项目",vbSystemModal) 
    Syscmd.Project.Exit() 
End If

--  作者:大红袍
--  发布时间:2016/5/5 15:33:00
--  

BeforeOpenProject事件

 

Dim sucess As Boolean = False
    MessageBox.Show("只能打开一次!")
End If
[此贴子已经被作者于2016/5/5 15:32:55编辑过]

--  作者:大红袍
--  发布时间:2016/5/5 15:34:00
--  
 
static mu As System.Threading.Mutex
Dim sucess As Boolean = False
mu = new System.Threading.Mutex(True, "名称", sucess)
If not sucess Then
    MessageBox.Show("只能打开一次!")
    e.Cancel = True
End If