C# 单实例运行控制
来源:互联网 发布:linux mint设置中文 编辑:程序博客网 时间:2024/05/22 16:42
static class Program { [DllImport("User32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow); [DllImport("User32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("User32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); private const int WS_SHOWNORMAL = 1; /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { bool MutexWasCreated; Mutex MyMutex = new Mutex(true, "OCRServer", out MutexWasCreated); if (MutexWasCreated) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmMain()); MyMutex.WaitOne(); } else { //“智能识别”是窗体的标题名称IntPtr ptr = FindWindow(null, "智能识别"); if (ptr != IntPtr.Zero) { ShowWindowAsync(ptr, WS_SHOWNORMAL); SetForegroundWindow(ptr); } } } }
0 0
- C# 单实例运行控制
- C# 单实例运行
- c# 单实例运行
- C# windows应用程序单实例运行实例
- C#单实例运行的实现
- C# Mutex实现程序单实例运行
- c# wpf单实例运行并激活前实例
- 利用C#线程机制实现应用程序的单实例运行
- 利用C#线程机制实现应用程序的单实例运行
- C#使用Mutex实现程序单实例运行
- C# WinForm 程序单实例运行,再次运行时激活前一个实例
- 【转】C# WinForm 程序单实例运行,再次运行时激活前一个实例
- 单实例运行
- VB 单实例运行
- 单实例运行程序
- 实现单实例运行
- WinForm单实例运行
- Winform 单实例运行
- excel导出图片
- Rotate Image
- SQLloader 导入文本字段有中特别符号的操作方法
- 解决软件发布后在其他机器上无法运行问题
- 10款最佳Android快速应用程序切换
- C# 单实例运行控制
- tomcat 中文乱码
- Android Fragment的使用
- NavigationItem的背景和title的属性
- css浏览器兼容
- C#----Graphics中部分方法的使用和理解
- JAVA 调用 MySQL
- 机器学习
- JAVA调用DB2过程