Using container window handle to set parent of a Form derived clas

M

Marcos

Hi, I'm developing an application and I would like to host it inside the
client area of Internet explorer and maybe some other containers. It needs to
have a MDI functionality. But I can't set the parent of a form to be a non
managed window. But when I use the ShowDialog or MessageBox.Show from within
the internet explorer, it acts as a modal in relation to the IE. How does the
..net framework does it ?
Thanks in advance.
Marcos
 
A

Aflava

Hi,

Did you tried to override createparams and set the parent property to your
desired parent?
 
M

Marcos

Hi,
Thanks for answering. I tried this now and still doesn't work. I would like
to have a Owner kind of behavior on the created forms in relation to the
control embedded inside internet explorer. Like a MDI application inside the
browser client area.
Thanks in advance
Marcos
 
J

John Sturmer

I just did something very similar which ALMOST works. I need to include a .NET Windows Form in a COM Add-In in an MS Access Window and have it behave like an MDI.

The following code works:
[DllImport("user32.dll")]
private static extern IntPtr SetParent
(IntPtr child, IntPtr newParent);

public void SetOwner(bool RemoveOwner)
{
if (RemoveOwner)
{
SetParent(this.Handle, new IntPtr());
}
else
{
int AccHdl = this.AppObj.hWndAccessApp();
IntPtr AccPtr = new IntPtr(AccHdl);
SetParent(this.Handle, AccPtr);
}
}
Note that I am getting the handle to the Access App from the application object, but using the FindWindow API works just as well.

The one problem I am having is that my MainMenu no longer functions when I do that.
 

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