title: Opening external application inside VB.NET MDI Form
body: <p>I need to open some external applications such as notepad.exe inside the VB.NET MDI form, and also I need to make sure that there is exactly only one copy of this running always.</p>
  
  <p>I used the code below, but it does absolutely nothing at all. It gives the error SetParent is not declared and findWindow is not declared</p>
  
  <pre><code>Dim myProcess As Process = New Process()
  Dim MyHandle As IntPtr
  myProcess.StartInfo.FileName = "Notepad.exe"
  myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
  myProcess.Start()
  MyHandle = FindWindow(vbNullString, "C:\Windows\Notepad.exe")
  SetParent(MyHandle, Me.Handle)
  myProcess.WaitForExit()
  </code></pre>
  
  <p>This is the code I used to verify that only one instance is running</p>
  
  <pre><code>If (System.Diagnostics.Process.GetProcesses.Equals("notepad.exe")) Then
          MsgBox("Only One Instance!")
      Else
          Dim p As New System.Diagnostics.Process
          p.StartInfo.FileName = "notepad.exe"
          p.Start()
      End If 
  </code></pre>
  
  <p>This code is opening notepad.exe but it is NOT checking for previous instances. So everytime I click the button it opens a new Notepad</p>