Our plugin model isolates plugins in their own AppDomain so that if a plugin crashes it doesn't take down our whole client app. This also allows for us to unload and load plugins if we choose to. The problem I've run into is now it's much harder to show
my plugins (each have their own windows Form) in my main mdi window.
So I thought, why not pass the handle to the main window since I can pass primitives accross AppDomains? I then implemented a method in the main window where you pass in the plugin handle and it shows it in the main mdi window. Here's my code:
uint style = GetWindowLongPtr(formHandle, GWL_STYLE);
style &= ~WS_POPUP;
style = style | WS_CHILD | WS_VISIBLE;
SetWindowLong(formHandle, GWL_STYLE, style);
This approach seems to be buggy though...
1. The title bars of plugin windows always appear inactive as if the window was not in focus
2. When I maximize a plugin window, it does not seem to be aware that my main window has a menu and toolbar docked to the top. The maximized plugin window sits right over the top of them
3. And worst of all plugin windows are always on top of the other managed windows
Has anyone successfully been able to get this working correctly? Or is there some other way I can do this?
It seems like a managed MdiClient is not aware of the native child windows that I've added...