Contain a VB6 form in a .Net MDI

匆匆过客 提交于 2019-12-18 07:08:41

问题


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

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?

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


回答1:


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

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

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.




回答2:


Sorry, I posted too soon here's the solution:

Embedding of VB6 form in .NET applications



来源:https://stackoverflow.com/questions/4953725/contain-a-vb6-form-in-a-net-mdi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!