richard072 wrote:
could be VERY useful to everybody
Whehe, good argument [laugh]
First, you add a using clause;
using System.Runtime.InteropServices;
Next, copy this code into your class;
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]<br />static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);<br />[DllImport("user32.dll", EntryPoint = "SetParent", SetLastError = true)]<br />static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
Next, add this code to the place where you want to change the parent;
IntPtr window = FindWindowByCaption(IntPtr.Zero, "Calculator");<br />SetParent(window, this.Handle);
--edit--
I posted the reverse thing, but it's also possible from C++ using the same technique. A quick suggestion tho - why not make an ActiveX-control out of the C# window?
Enjoy :)