国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#實現在Form里面內嵌dos窗體的方法

2020-01-24 01:29:10
字體:
來源:轉載
供稿:網友

本文實例講述了C#實現在Form里面內嵌dos窗體的方法。分享給大家供大家參考。具體如下:

using System;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Diagnostics;namespace cmdForm { public partial class Form1 : Form {  public Form1() {   InitializeComponent();  }  private void button1_Click(object sender, EventArgs e) {   Process p = new Process();   p.StartInfo.FileName = "cmd.exe ";//notepad.exe   p.Start();   System.Threading.Thread.Sleep(100);   SetParent(p.MainWindowHandle, this.Handle);   ShowWindow(p.MainWindowHandle, 3);  }  [DllImport("User32.dll ", EntryPoint = "SetParent")]  private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);  [DllImport("user32.dll ", EntryPoint = "ShowWindow")]  public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); }}

希望本文所述對大家的C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 隆安县| 安岳县| 高邑县| 华容县| 通化市| 香港 | 吴忠市| 浙江省| 京山县| 迁安市| 玉田县| 四子王旗| 都兰县| 志丹县| 巍山| 禄劝| 莲花县| 沙田区| 富源县| 油尖旺区| 通辽市| 扎赉特旗| 梅州市| 潢川县| 依兰县| 文安县| 九江市| 布拖县| 太保市| 乌鲁木齐市| 弥渡县| 微博| 合肥市| 福清市| 颍上县| 黔东| 广南县| 汉沽区| 贵州省| 外汇| 清流县|