私はVisual Studio 2012、Windowsフォームを使用しています。デスクトップのショートカットをクリックしたときに、システム トレイからアプリケーションを復元する必要があります。
同じアプリケーションの二重インスタンスを防止するこのコードを使用していますが、システム トレイからアプリケーションを開かないようにしています。
[STAThread]
static void Main()
{
string mutex_id = "my application";
using (Mutex mutex = new Mutex(false, mutex_id))
{
if (!mutex.WaitOne(0, false))
{
Form1 fForm;
fForm = new Form1();
fForm.Show();
fForm.WindowState = FormWindowState.Normal;
fForm.ShowInTaskbar = true;
// MessageBox.Show("Instance Already Running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
ここでいくつかの質問をスタックオーバーフローで読みましたが、運が悪かったです。このコードで何を変更する必要がありますか? 前もって感謝します!