SetParent() between C# form and C++ window

  • Thread starter Thread starter tmjiang
  • Start date Start date
T

tmjiang

Good day,

I'm trying to set a C# form as a child to a C++ window.
The C++ window is constructed by CreateWindowEx.
The C# form returns its handle through managed C++, and its style is
set to WS_CHILD before SetParent().

After SetParent(hndCSharpAsChild, hndCPPAsParent), the C# form
disappears.

I'm not sure if this problem were related to
http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/msg/8dfba1efcbee169b
http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/msg/0eb7c9c87d33ad9a
or not.

BTW, when I reverse the relationship between C# form and C++ window,
both of them work fine.

Sincerely,
Mike
 
Is it because that SetParent() can only work for MDI applications?
That is, if my parent window do not have that kind of characteristics,
it can not have a child window of C# form.
On the other hand, if I set the style of C# form to WS_POPUP, not only
itself disappears, but the parent C++ window does.

When I was using CreateWindowEx between 2 C++ windows, there seems to
be not so many restrictions.
 
Back
Top