|  | 
 
 
 楼主|
发表于 2013-9-16 17:21:41
|
显示全部楼层 
| 后来使用Mutex ,不再报错了。复制代码    bool isAppRunning = false;
    System.Threading.Mutex mutex = new System.Threading.Mutex(
        true,
        System.Diagnostics.Process.GetCurrentProcess().ProcessName,
        out isAppRunning);
    if (!isAppRunning)
    {
        MessageBox.Show("本程序已经在运行了,请不要重复运行!");
        Environment.Exit(1);
    }
    else
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
但是还是不能开机自启动。
 
 有没有什么好的方法,调试开机自启动的程序,看看是哪个地方报错了
 使用Vs2010调试,看到的错误信息:
 
 未处理 System.TypeInitializationException
 Message: “Surfer.Program”的类型初始值设定项引发异常。
 
 
 
 
 
 
 
 | 
 |