Focus process window, ShowWindow vs System Tray
- by ais
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);
}