只启动一个exe方法: using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Windows.Forms; namespace StringToImage { static class Program { [DllImport("user32.dll")] public static extern IntPtr FindWindow(Strin…
WinForm如果我们希望一次只打开一个程序,那么我们在程序每次运行的时候都需要检测线程是否存在该程序,如果存在就呼出之前的窗体,C#代码如下: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Windows.…
electron限制只启动一个应用 // ========================================================== // 限制只可以打开一个应用,2.x的文档 // const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => { // // Someone tried to run a second instance, we should focu…