ok, the title is pretty long and should tell the problem i\'m facing with.
Here is the code when minimizing to icon tray:
void MainFormResize(object
After looking through dozens of solutions including the link from Hans, I do not believe that the accepted answer's link will restore an app from the systray. All it seems to be doing is correctly managing a single instance and passing arguments to the single instance.
A more complete solution which was able to manage single instance, restore a minimised window and restore a systray window can be found on codeplex here. http://www.codeproject.com/KB/cs/SingleInstanceAppMutex.aspx
It's also extremely simple to incorporate into your own code.
Calling SetForegroundWindow() on an invisible window isn't going to work. There are many other possible failure mode, FindWindow() is a miserable one when you start passing null.
Don't invent this yourself, .NET already has great built-in support for single instance apps. You can even get a notification when a 2nd copy starts and pass the command line. Which is what you want here, simply restore the window instead of hacking the API. The code you need is here.