static void Main()
{
/*判断程序是否运行*/
bool pblnGotOwnership = false;
Mutex pobjMyMutex = null;
try
{
pobjMyMutex = new Mutex(true, "Application name and/or unique mutex key", out pblnGotOwnership);
if (pblnGotOwnership)
Application.Run(new frmMain());
else
System.Windows.Forms.MessageBox.Show("系统已经运行","系统提示");
}
finally
{
if (pobjMyMutex != null)
pobjMyMutex.Close();
}
}
{
/*判断程序是否运行*/
bool pblnGotOwnership = false;
Mutex pobjMyMutex = null;
try
{
pobjMyMutex = new Mutex(true, "Application name and/or unique mutex key", out pblnGotOwnership);
if (pblnGotOwnership)
Application.Run(new frmMain());
else
System.Windows.Forms.MessageBox.Show("系统已经运行","系统提示");
}
finally
{
if (pobjMyMutex != null)
pobjMyMutex.Close();
}
}
static void Main()
{
/*判断程序是否运行*/
bool pblnGotOwnership = false;
Mutex pobjMyMutex = null;
try
{
pobjMyMutex = new Mutex(true, "Application name and/or unique mutex key", out pblnGotOwnership);
if (pblnGotOwnership)
Application.Run(new frmMain());
else
System.Windows.Forms.MessageBox.Show("系统已经运行","系统提示");
}
finally
{
if (pobjMyMutex != null)
pobjMyMutex.Close();
}
}
分啊?
bool pblnGotOwnership = false;
Mutex pobjMyMutex = null;
try
{
pobjMyMutex = new Mutex(true, "Application name and/or unique mutex key", out pblnGotOwnership);
if (pblnGotOwnership)
Application.Run(new frmMain());
else
System.Windows.Forms.MessageBox.Show("系统已经运行","系统提示");
frmMain.
}
finallyif (pobjMyMutex != null)
pobjMyMutex.Close();其中frmMain是你的主窗体将上面的代码添加到
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
中
private void notifyIcon_DoubleClick(object sender, System.EventArgs e)
{
if(this.Visible == false) //显示主界面
{
this.Visible =true;
this.WindowState=FormWindowState.Normal; }
}但在static void Main() 怎样实现?