1、需要引用using System.Runtime.InteropServices; 2、 [DllImport(“user32.dll”, CharSet = CharSet.Auto)] public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab); [DllImport(“user32.dll”, CharSet = CharSet.Auto)] public static extern void SetForegroundWindow(IntPtr hWnd); 3、 static void KillCurrentAndShowMutexThread() { Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName(current.ProcessName); foreach (Process process in processes) { if (process.Id != current.Id) { if (process.MainModule.FileName == current.MainModule.FileName) { //Console.WriteLine(“Another same process is loading.”); //Console.WriteLine(“Current window will close in 3 seconds, current Id ={0}.”, curren......Read More>