Ensuring a single instance of your .Net application
[STAThread]
static void Main()
{
bool ok;
m = new System.Threading.Mutex(true, "YourNameHere", out ok);
if (! ok)
{
MessageBox.Show("Another instance is already running.");
return;
}
Application.Run(new Form1());
GC.KeepAlive(m);
}Regards,Mitesh Mehtahttp://cc.1asphost.com/miteshvmehta/
No comments:
Post a Comment