title: MDI parent within another MDI parent form
body: <p>I am succeeded in opening MDI parent form within MDi parent form by using following method:
  I made two desktop applications(i.e. App1 and App2) having MDI parent forms as startup.
  In App1, I have added a panel on MDI parent in which we are going to open the other app i.e. App2.
  Now I added this code in App1.</p>
  
  <blockquote>
  <pre><code>using System.Diagnostics;
  using System.Runtime.InteropServices;
  </code></pre>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
  <pre><code>[DllImport("user32.dll")]
      static extern IntPtr SetParent(IntPtr hwndChild, IntPtr hwndNewParent);
  </code></pre>
  </blockquote>
  
  <pre><code>    [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
      static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, Int32 wParam, Int32 lParam);
  </code></pre>
  
  <p>Now in button click event the following code is used.(App1)</p>
  
  <pre><code>    // Create a new process
          Process proc;
  
          // Start the process
          proc = Process.Start(Application.StartupPath + @"\App2.exe");
          ////proc = Process.Start("notepad.exe");
          proc.WaitForInputIdle();
  
          // Set the panel control as the application's parent
          SetParent(proc.MainWindowHandle, this.panel1.Handle);
  
          // Maximize application
          SendMessage(proc.MainWindowHandle, 274, 61488, 0);
          MessageBox.Show(Application.OpenForms[0].ToString());
  </code></pre>
  
  <p>Here,Application.StartupPath + @"\App2.exe" is the process or EXE file which I built (Build solution, you know). Firstly,The code works fine when I debug with breakpoint but when I try to run it, the App2 opens as a different process but not in App1.  Secondly, I cannot open form which i have added in App2 which is opened as MDI child form (app2).</p>
  
  <pre><code>  Form1 frm = new Form1();
          frm.MdiParent = Application.OpenForms[0];
          frm.Show();
  </code></pre>
  
  <p>This is how I open child forms in MDI forms.</p>