Maybe a bit late for an answer to your question, but nevertheless here the answer, which I seem to have found:
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hP, IntPtr hC, string sC, string sW);
void MakeWin()
{
IntPtr nWinHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
nWinHandle = FindWindowEx(nWinHandle, IntPtr.Zero, "SHELLDLL_DefView", null);
SetParent(Handle, nWinHandle);
}
"MakeWin" should be called in the Constructor of the Form, best before "InitializeComponent".
Works good for me at least under Win7.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…