How can I bring focus and make the window have a normal state for a program that is minimized. I am trying to bring focus to an external program. Any help would be appreciated. This is what I got




[DllImport("user32.dll")]
public static extern int SetWindowLong(int window, int index, int
value);

[DllImport("user32.dll")]
public static extern int GetWindowLong(int window, int index);

[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);


[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(int hWnd);


public const int GWL_EXSTYLE = -20;
public const int WS_EX_TOOLWINDOW = 0x00000080;
public const int WS_EX_APPWINDOW = 0x00040000;





int hwnd = FindWindow("ConsoleWindowClass", "External window title");
int windowStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, windowStyle | WS_EX_APPWINDOW);
SetForegroundWindow(hwnd);



but it does not bring the window out of minimized state.