If I have a program of Winform or Wpf, for example A.exe, I double-click it,a window shows, and I hide it,then double-click A.exe again, how can I make the hiden window show again?
summary for winform(1,4 and 5 are required) and Wpf(1,2 and 3 are required):
1. SingleInstanceAppliction Class
internal class SingleInstanceAppliction
{
    private static Mutex _mutex;
    static SingleInstanceAppliction()
    {
        WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
    }
    internal static int WM_SHOWME { get; private set; }
    internal static void SetGuid(string guid)
    {
        _mutex = new Mutex(true, guid);
    }
    internal static void ReleaseMutex()
    {
        _mutex.ReleaseMutex();
    }
    internal static bool IsFirst()
    {
        return _mutex.WaitOne(TimeSpan.Zero, true);
    }
    [DllImport("user32")]
    private static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
    [DllImport("user32")]
    private static extern int RegisterWindowMessage(string message);
    internal static void PostMessage()
    {
        PostMessage((IntPtr)0xffff, WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
    }
}
2.For Wpf in App.xaml.cs
    protected override void OnStartup(StartupEventArgs e)
    {
        SingleInstanceAppliction.SetGuid("{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
        if (SingleInstanceAppliction.IsFirst())
        {
            base.OnStartup(e);
            SingleInstanceAppliction.ReleaseMutex();
        }
        else
        {
            SingleInstanceAppliction.PostMessage();
            Shutdown();
        }
    }
3.For Wpf in MainWindow.xaml.cs
    protected override void OnSourceInitialized(EventArgs e)
    {
        base.OnSourceInitialized(e);
        var source = PresentationSource.FromVisual(this) as HwndSource;
        source.AddHook(WndProc);
    }
    private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
    {
        if (msg == SingleInstanceAppliction.WM_SHOWME)
        {
            if (WindowState == WindowState.Minimized)
            {
                WindowState = WindowState.Normal;
            }
            var top = Topmost;
            Topmost = true;
            Topmost = top;
        }
        return IntPtr.Zero;
    }
4.For Winform in Program.cs
    [STAThread]
    private static void Main()
    {
        SingleInstanceAppliction.SetGuid("{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
        if (SingleInstanceAppliction.IsFirst())
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            SingleInstanceAppliction.ReleaseMutex();
        }
        else
        {
            SingleInstanceAppliction.PostMessage();
        }
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
5.For Winform in Form1.cs
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == SingleInstanceAppliction.WM_SHOWME)
        {
            if (WindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Normal;
            }
            var top = TopMost;
            TopMost = true;
            TopMost = top;
        }
        base.WndProc(ref m);
    }
 
     
     
    