摘要:
View Code public class MyProcess { private bool haveMainWindow = false; private IntPtr mainWindowHandle = IntPtr.Zero; private int processId = 0; private delegate bool EnumThreadWindowsCallback(IntPtr hWnd, IntPtr lParam); public IntPtr GetMainWindowHandle(int p... 阅读全文
摘要:
bool bOnlyOneInstance = false;System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.UserAppDataPath.Replace(@"\", "_"), out bOnlyOneInstance);if (!bOnlyOneInstance) { MessageUtil.ShowTips("程序已经运行!"); System.Environment.Exit(0); return; } 阅读全文