写文件有风险。非法关闭,或者任务管理器里面关闭,文件没删除的话,就再打不开项目了
可以用下面代码实现
全局代码:
Public mu As System.Threading.Mutex
BeforeOpenProject事件:
Dim sucess As Boolean = Falsemu = new System.Threading.Mutex(True, "dsdfhdfghf", sucess)If not sucess Then MessageBox.Show("只能打开一次!") e.Cancel = TrueEnd If
收藏,谢谢!