0

I want to run an external .exe file inside a panel in a c# Windows Form application, I tried the following code:

  [DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hwc, IntPtr hwp);
    ...
private void button3_Click_3(object sender, EventArgs e)
{
    Process process = Process.Start("calc.exe");
    Thread.Sleep(500);
    process.WaitForInputIdle();
    SetParent(process.MainWindowHandle, this.panel1.Handle);
 }

The process starts, but calc.exe is not confined into panel1. How can I lock it there?

0 Answers0