title: Removing the Title bar of external application using c#
body: <p>My application starts up another external application.</p>
  
  <p>I want to remove the title bar of this external application once it has started.</p>
  
  <p>Is this feasible, and if so how would it be done?</p>
  
  <p><strong>Based on the comments I am using the working code below</strong></p>
  
  <pre><code>//Finds a window by class name
  [DllImport("USER32.DLL")]
  public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  
  //Sets a window to be a child window of another window
  [DllImport("USER32.DLL")]
  public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
  
  //Sets window attributes
  [DllImport("USER32.DLL")]
  public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
  
  //Gets window attributes
  [DllImport("USER32.DLL")]
  public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
  
  [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
  static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
  
  
  //assorted constants needed
  public static int GWL_STYLE = -16;
  public static int WS_CHILD = 0x40000000; //child window
  public static int WS_BORDER = 0x00800000; //window with border
  public static int WS_DLGFRAME = 0x00400000; //window with double border but no title
  public static int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar
  
  public void WindowsReStyle()
  {
      Process[] Procs = Process.GetProcesses();
      foreach (Process proc in Procs)
      {
          if (proc.ProcessName.StartsWith("notepad"))
          {
              IntPtr pFoundWindow = proc.MainWindowHandle;
              int style = GetWindowLong(pFoundWindow, GWL_STYLE);
              SetWindowLong(pFoundWindow, GWL_STYLE, (style &amp; ~WS_CAPTION));
          }
      }
  }
  </code></pre>