public ScreenSaverForm(IntPtr PreviewWndHandle)
: this()
{
// Set the preview window as the parent of this window
NativeMethods.SetParent(this.Handle, PreviewWndHandle);
// Make this a child window so it will close when the parent dialog closes
NativeMethods.SetWindowLong(this.Handle, -16, new IntPtr(NativeMethods.GetWindowLong(this.Handle, -16) | 0x40000000));
// Place our window inside the parent
Rectangle ParentRect;
NativeMethods.GetClientRect(PreviewWndHandle, out ParentRect);
Size = ParentRect.Size;
Location = new Point(0, 0);
previewMode = true;
}