Launch a .exe application - not Notepad - inside a Panel in a WinForm using EnumWindows
<p>I need to launch some Windows apps to run inside a form.  I'm developing a Windows desktop app on C# using VS-15 IDE.</p>

<p>This topic has been tackled in SO many years ago. This is the best answer I found:</p>

<p><a href="https://stackoverflow.com/questions/758494/how-can-i-run-another-application-within-a-panel-of-my-c-sharp-program">How can I run another application within a panel of my C# program?</a>  </p>

<p>However all examples deal with launching Notepad, which works ok.  I indeed can launch and run notepad inside a target panel in a target form, and works perfectly.</p>

<p>But I don't need to launch Notepad,  I need to launch other installed apps,  and have found the frustrating reality that's impossible to launch the desired app inside the target panel/form.  It just opens outside the form.</p>

<p>Even found a post in which a OP needs to launch IE,  but the same result,  IE starts outside the form.</p>

<p>Reading and reading related topics, I've found that it could be a probability of being solved using something called <strong>EnumWindows</strong>.  I'm really new to C#, I usually deal with Python. I'm not even native to windows, had to install it in a VM.</p>

<p>I'm using Visual Studio 2015.  The expected output is a desktop app to Windows 7 and 8 machines, 64 bits.</p>

<p>The code:</p>

<pre><code>using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;

namespace &lt; &gt;
{
public partial class Form1: 
  {

   private void btn_qui_Click(object sender, EventArgs e)

     {
        var postventa = new appUser("POSTVENTA", "",3);

        try
        {
            frm_3.Show();
            Process p = Process.Start("C://QuiterWeb/QuiterWeb.exe");
            p.WaitForInputIdle();
            SetParent(p.MainWindowHandle, frm_3.panel_3.Handle);

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
  }
</code></pre>

<p>}</p>

<p>When running the code, the .exe opens outside the form.  But if instead I make it open notepad.exe,  it opens inside the specific panel and form.  Which indicates that the destination is well mapped to the method.  </p>

<p>What is wrong here?  How to make the .exe run inside the panel and form?</p>