Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
920 views
in Technique[技术] by (71.8m points)

vb.net - Contain a VB6 form in a .Net MDI

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...