C#實現(xiàn)在Form里面內(nèi)嵌dos窗體的方法
更新時間:2015年09月04日 12:57:12 作者:我心依舊
這篇文章主要介紹了C#實現(xiàn)在Form里面內(nèi)嵌dos窗體的方法,涉及C#針對Form窗體的設(shè)置及使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了C#實現(xiàn)在Form里面內(nèi)嵌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#程序設(shè)計有所幫助。
相關(guān)文章
C# 如何設(shè)置label(標(biāo)簽)控件的背景顏色為透明
這篇文章主要介紹了C# 如何設(shè)置label(標(biāo)簽)控件的背景顏色為透明,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下2020-10-10C#模擬鏈表數(shù)據(jù)結(jié)構(gòu)的實例解析
這篇文章主要介紹了C#模擬鏈表數(shù)據(jù)結(jié)構(gòu)的實例解析,包括隊雙向鏈表的模擬方法,例子中隊鏈表的操作也有很好的說明,需要的朋友可以參考下2016-04-04c#文件的復(fù)制,移動,創(chuàng)建(實例代碼)
c#文件的復(fù)制,移動,創(chuàng)建(實例代碼),需要的朋友可以參考一下2013-04-04