static extern bool GetClientRect(IntPtr hWnd, ref RECT lpRect);
        /// <summary>
        /// Shows screen saver preview by creating one instance of ScreenSaverWindow.
        /// 
        /// Note: uses WinForms's Screen class to get monitor info.
        /// </summary>
        internal void ShowPreview(String arg)
        {
            System.Windows.Point scale = Interop.GetVisualScale();
            Debug.WriteLine(scale);

            fx = new GrayscaleEffect
            {
                Chrominance = App.Config.Chrominance,
                Negative = App.Config.Negative,
                LeaveBlack = App.Config.LeaveBlack
            };

            //set volume and stretch method
            this.VideoElement             = new MediaElement();
            VideoElement.UnloadedBehavior = MediaState.Manual;
            VideoElement.Source           = App.Config.Video;
            VideoElement.IsMuted          = false;
            VideoElement.Volume           = App.Config.Volume;
            VideoElement.Stretch          = App.Config.Stretch;
            VideoElement.MediaEnded  += new RoutedEventHandler(VideoElement_MediaEnded);
            VideoElement.MediaOpened += new RoutedEventHandler(VideoElement_MediaOpened);

            Int32  previewHandle = Convert.ToInt32(arg);
            IntPtr pPreviewHnd   = new IntPtr(previewHandle);
            RECT lpRect          = new RECT();
            bool bGetRect        = GetClientRect(pPreviewHnd, ref lpRect);

            this.winSaver = new ScreenSaverWindow(new VisualBrush(VideoElement));
            HwndSourceParameters sourceParams = new HwndSourceParameters("sourceParams");

            //set window properties
            sourceParams.Height = lpRect.Bottom - lpRect.Top;
            sourceParams.Width = lpRect.Right - lpRect.Left;
            sourceParams.ParentWindow = pPreviewHnd;
            sourceParams.WindowStyle = (int)(0x10000000 | 0x40000000 | 0x02000000);

            //set up preview
            winWPFContent = new HwndSource(sourceParams);
            winWPFContent.Disposed += new EventHandler(winWPFContent_Disposed);
            winWPFContent.RootVisual   = winSaver.grid1;
            winSaver.Width             = (lpRect.Right  - lpRect.Left) / scale.X;
            winSaver.Height            = (lpRect.Bottom - lpRect.Top)  / scale.Y;
            winSaver.VideoBlock.Width  = (lpRect.Right  - lpRect.Left) / scale.X;
            winSaver.VideoBlock.Height = (lpRect.Right  - lpRect.Left) / scale.X;

            //set a background
            //Note: Uses an arbitrary screen size to determine when to do this
            if (winSaver.Width <= 320 && winSaver.Height <= 240)
            {
                winSaver.DesktopBackground.Source = new BitmapImage(new Uri(Interop.GetDesktopWallpaper(), UriKind.Absolute));
                winSaver.DesktopBackground.Stretch = Interop.GetWallpaperStretch();
            }

            winSaver.isPreview = true;
            winSaver.Show();
            VideoElement.Play();
        }