MDI child forms and SetParent PInvoke call

G

Guest

OK, so this is a WinForms/Interop question. I have a scenario in which my
client wants to "host" existing ActiveX controls within a .NET MDI so they
can gradually replace each ActiveX control with .NET implementations over
time and not all at once. Problem is some of the controls use a 3rd party
OCX which when the containing WinForm's MdiParent property is set the app
will throw a protected memory violation exception. The vendor has been
contacted and found a bug in their OCX but will not be releasing another
patch for 3-4 months.

In the mean time I figured out I could instantiate the WinForm with the 3rd
party OCX and then use a PInvoke to call user32.dll SetParent(childHandle,
parentHandle) and the control does not puke. Problem is with this scenario
some of the MDI functionality is lost:

1. scroll bars in the parent do not automatically appear
2. child windows can be moved to cover StatusStrip and MenuStrip controls
3. maximize of child window covers everything except title bar and the form
borders of the parent form

Is there any way to change these child windows to appear to function just
like .NET MDI windows should?

Environment
---------------
..NET 2.0
Windows XP sp2


Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top