Focus process window, ShowWindow vs System Tray
        Posted  
        
            by ais
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ais
        
        
        
        Published on 2010-04-19T13:58:53Z
        Indexed on 
            2010/04/19
            14:03 UTC
        
        
        Read the original article
        Hit count: 235
        
I try open process window, this code work if window state is minimize, but if program in system tray window isn't opened.
[DllImport("User32")]
private static extern int SetForegroundWindow(IntPtr hwnd);
[DllImport("User32")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private static void ShowWindow(Process process)
{
    ShowWindow(process.MainWindowHandle, SW_RESTORE);
    SetForegroundWindow(process.MainWindowHandle);
}
        © Stack Overflow or respective owner