C#實(shí)現(xiàn)在Form里面內(nèi)嵌dos窗體的方法
更新時(shí)間:2015年09月04日 12:57:12 作者:我心依舊
這篇文章主要介紹了C#實(shí)現(xiàn)在Form里面內(nèi)嵌dos窗體的方法,涉及C#針對Form窗體的設(shè)置及使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了C#實(shí)現(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è)計(jì)有所幫助。
相關(guān)文章
C#使用foreach循環(huán)遍歷數(shù)組完整實(shí)例
這篇文章主要介紹了C#使用foreach循環(huán)遍歷數(shù)組,結(jié)合完整實(shí)例形式較為詳細(xì)的分析了C#遍歷數(shù)組的相關(guān)技巧,需要的朋友可以參考下2016-06-06
jQuery結(jié)合C#實(shí)現(xiàn)上傳文件的方法
這篇文章主要介紹了jQuery結(jié)合C#實(shí)現(xiàn)上傳文件的方法,涉及C#文件上傳的相關(guān)技巧,需要的朋友可以參考下2015-04-04
C#實(shí)現(xiàn)帶行數(shù)和標(biāo)尺的RichTextBox
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)帶行數(shù)和標(biāo)尺的RichTextBox,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下2022-12-12
Unity實(shí)現(xiàn)物體運(yùn)動時(shí)畫出軌跡
這篇文章主要為大家詳細(xì)介紹了Unity實(shí)現(xiàn)物體運(yùn)動時(shí)畫出軌跡,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-09-09

