public partial class eTerm_Form : WinFormsUI.Docking.DockContent
{
public eTerm_Form()
{
InitializeComponent();
}

Process process = null;
IntPtr appWin;

[DllImport("user32.dll", SetLastError = true)]
private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetWindowPos(IntPtr hwnd, long hWndInsertAfter, long x, long y, long cx, long cy, long wFlags);
[DllImport("user32.dll", SetLastError = true)]
private static extern bool MoveWindow(IntPtr hwnd, int x, int y, int cx, int cy, bool repaint);

private void eTerm_Form_Resize(object sender, EventArgs e)
{
if (this.appWin != IntPtr.Zero)
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
}

private void eTerm_Form_Load(object sender, EventArgs e)
{
try
{
process = System.Diagnostics.Process.Start(@”E:MyProjectNewSkyrickieManageSkyrickieManageShenZhen.skyrickie.SkyrickieManagebinDebugSkyrickieManage.exe”);
process.WaitForInputIdle();
appWin = FindWindow(null, “skyrickie个人管理系统登录”);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, “Error”,MessageBoxButtons.OK, MessageBoxIcon.Error);
}

SetParent(appWin, this.Handle);
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
}

private void eTerm_Form_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
if (!process.HasExited)
process.Kill();
}
catch
{
}
}
}

把第三方的exe程序嵌入C#界面上的更多相关文章

  1. exe程序嵌入Winform窗体

    1.新建winform程序,添加一个Panel控件和一个button控件,winform窗体命名为:Mainform: 2.新建一个类文件,方便引用,命名为:exetowinform: 3.Mainf ...

  2. C# 将外部exe程序 嵌入到自己的窗体界面

    将别人开发的exe程序,放到自己的窗体里面来运行. 1.基本功能实现 首先,在自己的窗体后面加上代码: [DllImport("User32.dll", EntryPoint = ...

  3. C# 使用Win32 API将1个EXE程序嵌入另1个程序中

    已经干到天快亮了,就不废话直接贴点儿代码吧 ; ; /// <summary> /// 查找窗口 ///第一个参数是窗口的标题,第二个参数可直接用 null ///通过窗口的标题查找对应的 ...

  4. WPF应用程序嵌入第三方exe

    把其它应用嵌入到C#窗口 源代码-CSDN下载 https://download.csdn.net/download/aiqinghee/10652732 WPF应用程序嵌入第三方exe - gao2 ...

  5. Qt界面中嵌入其他exe程序的界面,使用Qt5

    下面用一个小例子来演示如何在Qt的界面中嵌入其他exe程序的界面,最终效果如下图所示.本文参考了 http://blog.csdn.net/jiaoyaziyang/article/details/4 ...

  6. C#将exe运行程序嵌入到自己的winform窗体中

    以下例子是将Word打开,然后将它嵌入到winform窗体中,效果如下图:C将exe运行程序嵌入到自己的winform窗体中 - kingmax_res - iSport注意:该方法只适用于com的e ...

  7. 外部exe窗体嵌入winform

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  8. 使用InstallAnywhere7.1制作Java exe程序安装包

    [转[使用InstallAnywhere7.1制作Java exe程序安装包 使用InstallAnywhere7.1制作Java exe程序安装包 对于已经完成的Java应用程序开发项目,从商业化角 ...

  9. .net 部署到服务端IIS,Process调用exe程序无法运行问题解决

    场景: 开发某一功能将html内容转换为pdf,采用第三方插件wkhtmltopdf.exe进行转换.在本地调试正常运行,部署到服务端后文件没有正常生成. IIS中,Process打不开cmd程序,程 ...

随机推荐

  1. Laravel5.2 下使用Form

    laravel到了5.1.*以上版本,便没有了illuminate/html类库的支持, 我试着把illuminate/html类库加入了laravel5.2,依然没有用, 但是laravelcoll ...

  2. spring 学习2

    package com.asm; //...省略导入的相关类 public class MessageController implements Controller { public ModelAn ...

  3. jquery easyui Tab 引入页面的问题

    jQuery Easyui 的tabs插件有两种方式加载某个tab(标签页)上的内容:“href远程请求”和“content本地内容”,本文就两种方式的优缺点进行简单分析和思考. 两者特点: href ...

  4. Android 监听wifi广播的两种方式

    1.XML中声明 <receiver android:name=".NetworkConnectChangedReceiver" >             <i ...

  5. bash:command not found

    在linux下执行某一常用命令时,提示类似错误信息:bash:bash:command not found 原因是所执行的命令在当前系统环境变量里找不到路径. 例如:刚安装了openOffice时,执 ...

  6. Ajax&XMLHttpRequest

    XMLHttpRequest 简单省力的方法 将文件编码成base64通过Ajax上传 HTML5学习之FileReader接口 HTML5学习之FileReader接口 通过Ajax方式上传文件,使 ...

  7. AlwaysON同步过程

    <SQL Server 2012实施与管理实战指南>中指AlwaysON同步过程如下: 任何一个SQL Server里都有个叫Log Writer的线程,当任何一个SQL用户提交一个数据修 ...

  8. 关于一个下载的源代码中的”*.vssscc“文件的问题

    今天下载了一份程序的源代码,老是提示我要连接源代码管理服务器,这个……你的账号密码我怎么知道,有木有.于是上网搜罗了一番找来了解决方案,在这里分享给可能出现同样问题的童鞋. 首先说明一下什么是vsss ...

  9. HTML5 Canvas图像放大、移动实例1

    1.前台代码 <canvas id="canvasOne" class="myCanvas" width="500" height=& ...

  10. channel c3 disabled, job failed on it will be run on another channel

    今天执行备份时,报错: allocated channel: c3 channel c3: sid=131 instance=orcl2 devtype=DISK   RMAN-03009: fail ...