C#, how to open an .exe in WinForm
Did you know that you can open .exe files in WinForm?
You can use user32.dll in Windows to do this.
In user32.dll;
SetParent – Allows to open .exe in winform.
SetWindowLong – Sets the .exe’s window style.
MoveWindow – Changes the location of the .exe in WinForm.
[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", EntryPoint = "SetWindowLongA", SetLastError = true)]
private static extern long SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong);
const int WM_SYSCOMMAND = 274;
const int SC_MAXIMIZE = 61488;
[DllImport("user32.dll")]
private static extern bool MoveWindow(IntPtr hwnd, int x, int y, int cx, int cy, bool repaint);
private const int GWL_STYLE = (-16);
private const int WS_VISIBLE = 0x10000000;
For example;
Process p = new Process();
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.UseShellExecute = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p = Process.Start("charmap.exe");
p.WaitForInputIdle();
SetParent(p.MainWindowHandle, this.Handle);
this.Text = p.MainWindowTitle;

It looks like this.
try
{
SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
}
catch { }
MoveWindow(p.MainWindowHandle, 0, 0, this.Width, this.Height, true);

Notes;
Some .exe files may not open in winform.
And you can open .cpl .msc files as well as .exe file.