public Rectangle CalculateWindowRectangle()
        {
            if (handle.ToInt32() > 0)
            {
                rectangle = CaptureHelpers.GetWindowRectangle(handle);

                NativeMethods.GetWindowThreadProcessId(handle, out processId);

                string processName = Process.GetProcessById((int)processId).ProcessName;

                if (!Engine.ConfigWorkflow.ActiveWindowTryCaptureChildren || processName == "explorer")
                {
                    windows.Enqueue(new KeyValuePair<IntPtr, Rectangle>(handle, rectangle));
                }
                else
                {
                    NativeMethods.EnumWindowsProc ewpWindows = new NativeMethods.EnumWindowsProc(EvalWindows);
                    NativeMethods.EnumWindows(ewpWindows, IntPtr.Zero);
                }

                foreach (KeyValuePair<IntPtr, Rectangle> window in windows)
                {
                    rectangle = rectangle.Merge(window.Value);
                    NativeMethods.EnumWindowsProc ewpControls = new NativeMethods.EnumWindowsProc(EvalControls);
                    NativeMethods.EnumChildWindows(window.Key, ewpControls, IntPtr.Zero);
                }

                foreach (KeyValuePair<IntPtr, Rectangle> control in controls)
                {
                    rectangle = rectangle.Merge(control.Value);
                }

                rectangle.Intersect(bounds);

                //TestRectangle(rectangle);

                return rectangle;
            }

            return Rectangle.Empty;
        }