C# ????????????????????
???????????? ???????[ 2013/12/24 16:36:07 ] ??????????????? C#
?????????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());
}
}
|
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11