zoukankan      html  css  js  c++  java
  • C#窗体内嵌外部程序(cmd.exe)的显示

    [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);

    private void button3_Click(object sender, EventArgs e)

            {

                Process p = new Process();

                p.StartInfo.FileName = "cmd.exe ";

                p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;//加上这句效果更好

                p.Start();

                System.Threading.Thread.Sleep(100);//加上,100如果效果没有就继续加大

     

                SetParent(p.MainWindowHandle, panel1.Handle); //panel1.Handle为要显示外部程序的容器

                ShowWindow(p.MainWindowHandle, 3);

            }

  • 相关阅读:
    Java Concurrency
    Java Annotation,Java注解
    Think in java, notes
    嵌套事务
    java dynamic proxy,动态代理
    埃里克·雷蒙德
    HDU1222 Wolf and Rabbit
    HUT1098 素MM
    HDU1568 Fibonacci
    HDU1501 Zipper DFS+记忆化搜索
  • 原文地址:https://www.cnblogs.com/scgw/p/2435735.html
Copyright © 2011-2022 走看看