SoFunction
Updated on 2025-03-07

C# implements the method of embedding dos form in Form

This article describes the method of C# to embed a dos form in Form. Share it for your reference. The details are as follows:

using System;
using ;
using ;
using ;
namespace cmdForm {
 public partial class Form1 : Form {
  public Form1() {
   InitializeComponent();
  }
  private void button1_Click(object sender, EventArgs e) {
   Process p = new Process();
    = " ";//
   ();
   (100);
   SetParent(, );
   ShowWindow(, 3);
  }
  [DllImport(" ", EntryPoint = "SetParent")]
  private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
  [DllImport(" ", EntryPoint = "ShowWindow")]
  public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
 }
}

I hope this article will be helpful to everyone's C# programming.