While working on a calendar "glued to the desktop", I ran into the same problem.
Here is my solution:
/************ win32 interop stuff ****************/
[DllImport( "user32.dll", SetLastError = true )]
static extern int SetWindowLong( IntPtr hWnd, int nIndex, IntPtr dwNewLong );
[DllImport( "user32.dll", SetLastError = true )]
static extern IntPtr FindWindow( string lpWindowClass, string lpWindowName );
[DllImport( "user32.dll", SetLastError = true )]
static extern IntPtr FindWindowEx( IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle );
const int GWL_HWNDPARENT = -8;
/************* in Form_Load or equivalent ***************/
IntPtr hprog = FindWindowEx(
FindWindowEx(
FindWindow( "Progman", "Program Manager" ),
IntPtr.Zero, "SHELLDLL_DefView", ""
),
IntPtr.Zero, "SysListView32", "FolderView"
);
SetWindowLong( this.Handle, GWL_HWNDPARENT, hprog );
The tricky part was to set the form's owner (SetWindowLong + GWL_HWNDPARENT) instead of the form's parent (SetParent). This fixed the form not being rendered on an aero desktop.