An application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application. MSDN的原话.
至于嵌入的word,excel那些应该属于ole吧...
.NET WinForm 不支持Ole,这是MSDN上说的,所以楼主要的功能很难实现
EXCEL WORD 可以使用控件web浏览器 WebBrowser..但是嵌入另一个成应程序的Form 就没了解过
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
这个可以.
frm = new Form7();
frm.TopLevel = false;
this.panel1.Controls.Add(frm);
frm.Show();
楼主不妨找找
非托管-->非托管
托管-->非托管
非托管-->托管但是如果两个进程都是托管程序,则出现“内存不足”的异常。
MSDN的原话.
WebBrowser..但是嵌入另一个成应程序的Form 就没了解过
把 Main() 写到你那个窗口类中,就可以了。我记得是这样的,以前试过。
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName); public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
IntPtr hwnd = FindWindow(null, "ceshi");
if (hwnd != IntPtr.Zero)
{
SetParent(hwnd, panel2.Handle);
}
}经过亲自测试两个程序都是vs2008编写的winform,可以的。测试环境:vs2008
都一年多14个月了。使用《Csdn收音机》截图功能,轻松制作图文并茂的文章!
另外你还要写一些保持同步的代码
我理解,当前的运行消息队列,与你要运行窗体的消息队列无法相互操作
work,notepad 微软自己做了这些工作(相互通信,保持消息同步)