一键重装系统工具 | U盘启动盘制作工具 | 误删文件恢复软件 | 硬盘数据抢救专家 | 电脑蓝屏修复助手 | C盘空间清理神器 | 电脑驱动离线安装工具 | 微信聊天记录恢复工具 | 照片误格式化恢复 | 电脑密码破解清除工具 | 系统崩溃紧急救援盘 | 电脑加速优化大师 | 电脑开不了机怎么重装系统 | 回收站清空了怎么恢复 | 硬盘分区丢失数据恢复 | 电脑卡顿重装系统有用吗 | U盘插入提示格式化数据恢复 | 电脑中毒文件被隐藏恢复 | 忘记电脑开机密码怎么办 | 新硬盘分区对齐工具 | 旧电脑装Win10流畅工具 | SD卡照片删除恢复免费版 | 移动硬盘打不开提示损坏修复 | 电脑无故重启系统修复工具 | 电脑小白一键重装神器 | 程序员电脑环境配置助手 | 设计师电脑字体/素材恢复工具 | 网吧网管系统维护工具箱 | 财务人员电脑发票备份恢复 | 学生党免费电脑系统安装包 | 电脑维修师傅必备工具盘 | 游戏玩家电脑性能优化助手 | 办公白领误删文档恢复软件 | 自媒体视频素材恢复工具 | 网课录制视频损坏修复工具 | 最好的U盘PE系统排名 | 数据恢复软件哪个最强 | 免费电脑助手与收费版区别 | 国产装机工具哪款无广告 | 离线版驱动助手推荐 | 轻量级电脑优化工具对比 | 支持NVMe驱动的PE工具 | 带网络功能的应急启动盘 | 2026最新版万能装机工具 | 支持Win11 24H2的PE工具 | 最新免激活系统重装工具 | 2026数据恢复软件破解版合集 | 纯净无捆绑装机助手V3.0 | 支持苹果M芯片的电脑助手 | 秋季更新版系统维护工具箱 | 电脑系统崩了怎么用U盘把重要资料拷贝出来 | 重装系统前哪些文件夹必须备份 | 固态硬盘误格式化还能恢复数据吗 | 如何制作一个既带PE又能存数据的双分区U盘 | 电脑总是弹窗广告用什么助手彻底拦截 后台管理
📢 欢迎访问系统之家!所有资源均经过安全检测。

C#: how to detect window application is running and not launch the same application again?

发布时间:2026-09-11 | 浏览:1
📥 下载地址(文章开头)
一键制作系统U盘仅需下载到电脑后接上U盘点一下全自动完成。
Access to this page requires authorization. You can try signing in or changing directories . Access to this page requires authorization. You can try changing directories . Thursday, June 28, 2012 11:59 PM We have WinForm application (.NET Framework 3.5). Sometime the WinForm application is running in back by calling Hide(); If user click on the ~.exe again, we need to know if the WinForm application is already running, if so, 1) it should not launch the application again. 2) and it should show the running WinForm from Hide() to Show(). How to achieve that? Thx! All replies (13) Saturday, June 30, 2012 8:52 AM ✅Answered | 1 vote Single instance application implementation is been clearly described here by Scott and it's really easy to follow. Please click "Mark As Answer" if it serve the purpose.\n Regards, Nairs Saturday, June 30, 2012 5:53 PM ✅Answered I tested Scott Hanselman 's code adapted to show a hidden MainForm and it worked nicely. Here is the modified code that will solve your second question: In Form1.cs, you can remove the OnLoad override method and replace LoadFile with ShowForm Note that you need to add the Microsoft.VisualBasic (.NET tab) reference to your project. Dan Randolph - My Code Samples List Friday, June 29, 2012 2:59 AM | 1 vote You can use Mutex for this purpose. For more info visit this nice article, http://sanity-free.org/143/csharp_dotnet_single_instance_application.html I hope this helps. Please mark this post as answer if it solved your problem. Happy Programming! Friday, June 29, 2012 4:55 AM If this is helpful { Please Mark as Answered } else if it is not helpful { Un-Mark as Answered } Best Regards Huan Li, Code Blog: Small is New Big In C# Friday, June 29, 2012 4:58 AM Hello JJChen:-) In VB.NET, just right click ur proj and choose "properties", and check this, plzzzzzz…… QQ我: 下载MSDN桌面工具(Vista,Win7) 我的博客园 慈善点击,点击此处 Friday, June 29, 2012 5:28 AM This one doesn't work if I change the executable name and run it.
📥 下载地址(文章中间)
一键制作系统U盘仅需下载到电脑后接上U盘点一下全自动完成。
Please mark this post as answer if it solved your problem. Happy Programming! Friday, June 29, 2012 5:28 AM 2) and it should show the running WinForm from Hide() to Show(). How to achieve that? Thx! I tried this with a Win32 trick, but I could not get the form to show. The same function worked to restore the window state from minimized to normal though. If no one posts an easy solution for (2), I will post a code sample on how to do it using a signal via a named-pipe IO operation. I have this working, but it is too much code to post here. Dan Randolph - My Code Samples List Friday, June 29, 2012 5:44 PM Thanks for providing info. we found the application Guid from application AssemblyInfo.cs However the above code you provided does not work. the link you provide includes working code as following: static class Program { static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}"); [STAThread] static void Main() { if(mutex.WaitOne(TimeSpan.Zero, true)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); mutex.ReleaseMutex(); } else { MessageBox.Show("only one instance at a time"); } } } Friday, June 29, 2012 6:19 PM Please provide your code if you could. Thx! Friday, June 29, 2012 7:53 PM You can use Mutex for this purpose. For more info visit this nice article, http://sanity-free.org/143/csharp_dotnet_single_instance_application.html I hope this helps. Please mark this post as answer if it solved your problem. Happy Programming! It's worth noting that a solution along these lines will only work with benign users. If it's important for say security reasons that there not be two instances open this won't be sufficient as someone could decompile your code, and then re-compile it without that check. If the user is only shooting themselves in the foot by opening multiple instances, or the possible gains for them just aren't worth this kind of effort, then it's a fine solution. Friday, May 23, 2014 7:02 AM There are times mutex is not working in some areas. Like using in console application. So I tried using WMI Query. For more info you may email me here: ocbina_jay@hotmail.com, ocbina_jay@yahool.com htt://israelocbina.blogspot.com Thursday, May 3, 2018 5:50 AM This will not work properly if user change the the (.exe) file name Thursday, May 3, 2018 5:54 AM This is the perfect solution as if we depend on process name , user can simply change file name then process name will be changed Additional resources Last updated on 2012-06-28
📥 下载地址(文章结尾)
一键制作系统U盘仅需下载到电脑后接上U盘点一下全自动完成。