?????????Main?????????????£?
????if( RunningInstance() == null )
????Application.Run(new yourFormName());
????????:???????????????ProcessName????в?????п?????????Process??????????????????????????????????????????????(?ó??????????Σ??????????????У???????????????????).??????????????????????????????????????е????????????????????????????(???????????????)????????????????.
????3.VB??(??????????????????????????????????????)
???????????????????

 

using
Microsoft.VisualBasic.ApplicationServices;
static void Main(string[] args)
{
App myApp = new App();
myApp.Run(args);
}
class App : WindowsFormsApplicationBase
{
public App()
{
// ?????????
this.IsSingleInstance = true;
// ?????????XP???????
this.EnableVisualStyles = true;
// ????????????
this.ShutdownStyle = ShutdownMode.AfterMainFormCloses;
}
/// <summary>
/// ??дOnCreateMainForm()????
/// </summary>
protected override void OnCreateMainForm()
{
this.MainForm = new FormMain();
}
}
}

???????????????????????????????????????????????.???????Щ??????????????????????
????????????????????????????????????????????????????????????.?????????????????????????????????????????VB??????????????????OK??
????http://www.cnblogs.com/yuanyuan/p/3286916.html
????c# winform???????????
?????????????????exe??????????????????????????????????μ????????????????????????????????

 

staticvoid Main(){
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//?????????“XXXXX.vshost.exe”???????????????У?????????????
if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1)
{
MessageBox.Show("??????????????????У?"??"??????");
}
else
{
Application.Run(new frmTraceMold());
}
}