Avatar of janineo
janineo
Flag for United Kingdom of Great Britain and Northern Ireland asked on

.NET form as MDIChild of VB6 Application?

We have a very large legacy VB6 application.
This is used by 800 people every day. Upgrading it all to .NET is not an option.

We have been instead doing new forms, where possible, in a .NET COM dll and calling them from the VB6 app.

This is working fine except that the new forms are not MDI Children of the VB6 app.
Most forms are modal, so it's not a problem, but some are not.

Is there anyway to make the .NET forms MDI children of the VB6 app?
I assume it would require using Windows API functions, but I'm not sure how.

Thanks.
.NET ProgrammingVisual Basic Classic

Avatar of undefined
Last Comment
janineo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
borgunit

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
janineo

ASKER
Hmm, not quite true MDI child, but it will at least stop orphan forms hanging around after the app is closed.
Thanks for the link.
 
If anyone can point me a way to do true (or nearly true) MDI children, I'd appreciate it.
SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
janineo

ASKER
Sorry, I've had my work priorities shifted around and not had a chance to look at this yet.
It looks reasonable, so I'll split the points now as I don't know when I'll be able to get to this.

Thanks.
janineo

ASKER
I've had another chance to look at this now.
Unfortunately, SetParent doesn't work as expected.

The .NET form does not act like a child form. When maximised, it covers the parent form. It is always in front of other child forms, until a VB6 form gets the focus, at which point it disappears behind all of them, including the parent form.

I've done some web searching, and it appears that it is not possible for a VB6 MDI parent to adopt a child from another application.
If anybody has proof to the contrary, I'd be very interested.


Thanks,
Janine
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Mike Tomlinson

You might need to set the parent to a different hWnd than the main window (can't remember).

...but No, the .Net form (or any other external window) will not act as a TRUE MdiChild.  It will just be loosely "contained" by the VB6 window.
janineo

ASKER
I tried setting the parent to be a couple of different windows, and it didn't seem to make any difference.

It's a shame it doesn't act like a true MDIChild, that would solve most of our issues.