Application.Restart();
我在程序开始的时候会判断是否系统运行中 如果机器快的话会报系统已经在运行中了改如何处理?

解决方案 »

  1.   

    晕到 可以这样吗?          IntPtr t = new IntPtr(app.Hwnd);//创建可杀死的进程
                System.Diagnostics.Process p;
                int k = 0;
                GetWindowThreadProcessId(t, out k);
                p = System.Diagnostics.Process.GetProcessById(k);            p.Kill();//杀死后台进程
    没试过 我去试试
      

  2.   

    不想隐藏            Application.Restart();
                string procName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
                foreach (Process thisproc in Process.GetProcessesByName(procName))
                {
                    if (thisproc.CloseMainWindow())
                    { thisproc.Kill(); }
                }
    貌似现在没有以前的状况了