진행 과정 을 해치우다

1460 단어 프로세스
// 
        private void KillProcess(string processName)
        {
            // ,    
            System.Diagnostics.Process myproc = new System.Diagnostics.Process();
            //     
            try
            {
                //    
                foreach (Process thisproc in Process.GetProcessesByName(processName))
                {
                    //    
                    thisproc.Kill();
                }
            }
            catch (Exception Exc)
            {
                throw new Exception("", Exc);
            }
        } 

 
프로그램을 한 번만 실행할 수 있습니다
 /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //  
            if (System.Diagnostics.Process.GetProcessesByName

(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length == 1)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmControl());
            }
            esle
               messagebox.show(" "," ");
        }

좋은 웹페이지 즐겨찾기