Situation
The title may be confusing but I am working on a project where I need to run any program inside my own program. There is a thread about this issue Here.
Problem
This solution is using the the win32 API and is attaching the program to a panel handle. I've made an adjustment to make this working in WPF sins it does not support calling handle on a control.
This piece of code will launch notepad.exe inside my own program. My idea was to dock it inside my program.
[DllImport("user32.dll")] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
Process p = Process.Start("notepad.exe");
HwndSource source = (HwndSource)HwndSource.FromVisual(DockPanel);
SetParent(p.MainWindowHandle, source.Handle);
But now for some reason the program that I have opened whit the above approach can float in the boundaries of my program. Instead I only want it to be able to be docked to fill the hole dock panel. And not move out of it.
Question
How can I use boundaries so the program opened in my program will dock full in my dock panel and not move out of it. If there is a way without using dock panel it is not a problem.