在 .Net MDI 中包含 VB6 表单 [英] Contain a VB6 form in a .Net MDI

查看:19
本文介绍了在 .Net MDI 中包含 VB6 表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个旧的 VB6 应用程序移植到 .Net 中,但是一个 Vb6 表单太大而无法在此版本中迁移.

I'm porting an old VB6 app into .Net but one Vb6 form is too big to migrate in this release.

我将 Vb6 exe 外壳化以显示来自 .Net 的 VB6 表格,但 .Net MDI 中不包含 VB6 表格.我有一种直觉,感觉不可能在 .NET MDI 中嵌入 VB6 表单,有人知道这是否可能吗?

I Shell the Vb6 exe to show the VB6 form from .Net, but the VB6 form is not contained in the .Net MDI. I have a gut feeling its not possible to embed the VB6 form in the .NET MDI, does anyone know if this is possible?

我追求类似 Interop Forms Toolkit 2.1 甚至一个 API

I'm after something like Interop Forms Toolkit 2.1 or even an API

推荐答案

确实可以.这既不简单,也不是一个特别好的主意……

It is indeed possible. It's just neither simple, nor a particularly a good idea...

您需要为表单创建一个 ActiveX 容器,然后您可以将 VB 6 表单嵌入到该容器中.有关详细信息,请参阅 CodeProject 上的这篇文章:在 .NET 应用程序中嵌入 VB6 表单

You'll need to create an ActiveX container for the form, which you can then embed the VB 6 form into. See this article on CodeProject for details: Embedding of VB6 form in .NET applications

另一种可能的(并且非常简单的方法)可能是将 VB 6 表单的父级设置为 .NET MDI 容器.我实际上不确定这是否可行(我从未尝试过),但值得一试.您需要 P/Invoke FindWindow 函数 获取 VB 6 窗体窗口的句柄,以及 SetParent函数改变其父窗口.

Another possible (and significantly simpler approach) might be to set the parent of your VB 6 form as the .NET MDI container. I'm not actually sure if this will work (I've never tried it), but it's worth a shot. You'll need to P/Invoke the FindWindow function to get the handle to your VB 6 form window, as well as the SetParent function to change its parent window.

这篇关于在 .Net MDI 中包含 VB6 表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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