zoukankan      html  css  js  c++  java
  • 调用外部程序主窗体做子窗体

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

    引用API

     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, this.Handle);      

          

    ShowWindow(p.MainWindowHandle, 3);

  • 相关阅读:
    JSP 学习笔记1
    XML scriptlet 连接数据库
    JSP 定义行列数表单创建表格
    JSP_01
    JS创建表格完整
    04-基本的mysql语句
    03-MySql安装和基本管理
    02-数据库概述
    01-MySql的前戏
    爬虫系列
  • 原文地址:https://www.cnblogs.com/jinyuttt/p/2786335.html
Copyright © 2011-2022 走看看