public static Process RunningInstance() 

Process current = Process.GetCurrentProcess(); 
Process[] processes = Process.GetProcessesByName (current.ProcessName); 
//Loop through the running processes in with the same name 
foreach (Process process in processes) 

//Ignore the current process 
if (process.Id != current.Id) 

//Make sure that the process is running from the exe file. 
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName) 

//Return the other process instance. 
return process; 



//No other instance was found, return null. 
return null; 
}

解决方案 »

  1.   

    http://www.c-sharpcorner.com/FAQ/Create1InstanceAppSC.asp
      

  2.   

    这里:
    http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=E2A17727-765F-4346-8446-5D130622CB54
      

  3.   

    参考如下代码:
    foreach(Form f in this.MdiChildren)
    {
    if (f is frmMeRpt)
    {
    f.Focus();
    return;
    }
    }
    frmMeRpt frmMert = new frmMeRpt();
    frmMert.MdiParent = this;
    frmMert.ShowDialog();
      

  4.   

    singleton 模式是在远程处理(.net remoting)中,由服务器激活的对象的两种激活模式之一。它并不适用于一般的c#程序。
    有关singleton 的例子,可以在以下链接中找到:
    ms-help://MS.MSDNQTR.2003FEB.2052/cpqstart/html/cpsmpnetsamples-howtoremoting.htm#cpsmpSingletonSample