//是否可以打開新進程
bool newApp;
//獲取程式集Guid作為唯一標識
Attribute flag = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(GuidAttribute));
string guid = ((GuidAttribute)flag).Value;
_mutex = new System.Threading.Mutex(true, guid, out newApp);
if (false == newApp)
{
//發現重複進程
MessageBox.Show("應用系統不可重複開啟!");
return;
}
_mutex.ReleaseMutex();
沒有留言:
張貼留言