Title: Restore program from system tray clicking shortcuts in desktop in c#
Tags: c#;system-tray
Question: Im using Visual studio 2012, windows form. I need restore application from system tray when I click shortcut on desktop.

Im using this code that prevent double istance of same application, but not open application from system tray.

```[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());
        }
    }
```

I readed some questions here in stackoverflow, without luck. What I need modify in this code? thanks in advance!

Comment: http://stackoverflow.com/a/14326291/17034

Comment: I think this should answer your question: http://stackoverflow.com/questions/4592852/restoring-window-from-the-system-tray-when-allowing-only-one-instance-of-that-pr

Here is the accepted answer: You could use Mutex to accomplish this. Here is a bolt-on solution from CodePlex, that is very easy to incorporated into your program. The solution does provides the following features:


If the First Instance is Minimized to the System Tray (aka
"Notification Area"), Restore It 
Activating the First Instance
Prevent a Second Instance from Opening



Here is another answer: Check this question and answers with different ideas on getting instance of app that is already running. And check this link - http://msdn.microsoft.com/en-us/magazine/cc163741.aspx (look fo mutex).


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:02/03/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><system-tray>', 'Title': 'Restore program from system tray clicking shortcuts in desktop in c#', 'ViewCount': 1868, 'id': 14678613, 'user_AboutMe': "<p><strong>Catholic, Apostolic, Roman.</strong>\nEnthusiastic Coder and 3D Artist with the aim of spreading the Gospel.</p>\n<p>I I love Jesus Christ and Mary!\n<strong>Thanks my Lord</strong> because <strong>you are my Creator</strong> and I'm your creature! <strong>JHS</strong></p>\n<p>Anima Christi, sanctifica me.\nCorpus Christi, salva me.\nSanguis Christi, inebria me.\nAqua lateris Christi, lava me.\nPassio Christi, conforta me.\nO bone Jesu, exaudi me.\nIntra vulnera tua absconde me.\nNe permittas me separari a Te.\nAb hoste maligno defende me.\nIn hora mortis meae voca me,\nEt jube me venire ad Te,\nUt cum Sanctis tuis laudem Te\nIn saecula saeculorum.</p>\n", 'user_AccountId': 522347.0, 'user_DisplayName': 'Vincenzo Lo Palo', 'user_Reputation': 1303.0, 'user_Views': 155.0, 'user_id': 1780601.0}}