vb.net – “make single instance application”这是做什么的?

在vb 2008 express中,此选项在应用程序属性下可用.有谁知道它的功能是什么?这样做是为了不可能同时打开两个实例吗?
甚至有一种更简单的方法

使用以下代码……

Imports System.IO

在主窗体加载事件上执行以下操作:

If File.Exist(Application.StartupPath & "\abc.txt") Then
    'You can change the extension of the file to what ever you desire ex: dll,xyz etc.
    MsgBox("Only one Instance of the application is allowed!!!")
    Environment.Exit(0)
Else
    File.Create(Application.StartupPath & "\abc.txt",10,Fileoptions.DeleteonClose)
Endif

这将处理单个实例以及瘦客户端,并且在应用程序运行时无法删除文件.关闭应用程序或者如果应用程序崩溃,文件将自行删除.

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...