winform学习之----进程和线程

            Process[] pros = Process.GetProcesses();//获取多个进程
            foreach(var item in pros)
            {
                item.Kill();
                Console.Write(item);
            }

            Process.Start("calc");//打开计算器

            ProcessStartInfo psi = new ProcessStartInfo("@...");
            Process p = new Process();
            p.StartInfo = psi;
            p.Start();

           Thread th = new Thread(test);//开启线程
            th.Start();
            th.Abort();
            th.Start();

            if(th!=null)
            {
                th.Abort();//终止线程
            }

          //在.net下,不允许跨线程的访问处理办法:Control.CheckForIllegalCrossThreadCalls = false;

posted @ 2016-05-31 19:53  寒夜美美  阅读(177)  评论(0编辑  收藏  举报