반응형

Winform Project의 경우 Main 함수에서 프로세스가 실행중인지 체크한다

    internal static class Program
    {
        [STAThread]
        private static void Main()
        {
            System.Diagnostics.Process[] processes = null;
            string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToUpper();
            processes = System.Diagnostics.Process.GetProcessesByName(processName);
            if (processes.Length > 1) { return; }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
    }
반응형

+ Recent posts