嵌入在一个双赢表格在.NET中不同的应用 [英] Embedding different applications in a Win Form in .NET

查看:123
本文介绍了嵌入在一个双赢表格在.NET中不同的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使嵌入两个不同的应用程序在一个窗口形式?

How to embedd two different applications in a single windows form?

假设我有一个应用程序华南简介计算和有关网络摄像头,我想他们的形式说明了什么?

Suppose I have an application abour calculations and about web cam and I want them to show in a form?

不要只需要proccess.start()......

Don't need only proccess.start()....

推荐答案

我想你可能会寻找的的setparent的Windows API调用

要做到这一点,你需要导入相关的API调用:

To do this, you'd need to import the relevant API call:

[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

using指令添加到文件的顶部:

Add using directives at the top of the file:

using System.Diagnostics;
using System.Runtime.InteropServices;

启动外部和调用的setparent 就可以了(我们在这里使用记事本):

Start the external and call SetParent on it (we are using notepad here):

Process notepad = new Process();
ProcessStartInfo psi = new ProcessStartInfo("notepad.exe");
psi.WindowStyle = ProcessWindowStyle.Normal;
notepad.StartInfo = psi;

notepad.Start();
notepad.WaitForInputIdle(3000);            

SetParent(notepad.MainWindowHandle, this.Handle);

这应该工作,但我已经经历了一些奇怪的行为有了它,在一般情况下,我会避免,如果可能的。

This should work, but I've experienced some strange behaviour with it, in general, I would avoid it if possible.

这篇关于嵌入在一个双赢表格在.NET中不同的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆