int GlobalWindowProcCallback(int code, IntPtr wParam, IntPtr lParam, ref bool callNext)
        {
            CallWindowProcedureParam callbackParam = (CallWindowProcedureParam)Marshal.PtrToStructure(lParam, typeof(CallWindowProcedureParam));

            switch (callbackParam.message)
            {
            case WindowsMessage.WINDOWPOSCHANGED:
                WindowPositionChangedHandler(callbackParam);
                break;

            case WindowsMessage.POWERBROADCAST:
                Log.Info("Power Broadcast - {0}    {1}", wParam, lParam);
                break;

            case WindowsMessage.ACTIVATE:
            case WindowsMessage.ACTIVATEAPP:
            case WindowsMessage.CAPTURECHANGED:
            case WindowsMessage.ENTERSIZEMOVE:
            case WindowsMessage.ERASEBKGND:
            case WindowsMessage.EXITSIZEMOVE:
            case WindowsMessage.GETTEXT:
            case WindowsMessage.GETICON:
            case WindowsMessage.GETMINMAXINFO:
            case WindowsMessage.HSHELL_ACTIVATESHELLWINDOW:
            case WindowsMessage.IME_NOTIFY:
            case WindowsMessage.IME_SETCONTEXT:
            case WindowsMessage.KILLFOCUS:
            case WindowsMessage.MOVING:
            case WindowsMessage.NCACTIVATE:
            case WindowsMessage.NCCALCSIZE:
            case WindowsMessage.NCHITTEST:
            case WindowsMessage.NCPAINT:
            case WindowsMessage.NULL:
            case WindowsMessage.SETCURSOR:
            case WindowsMessage.SIZING:
            case WindowsMessage.SIZE:
            case WindowsMessage.WININICHANGE:
            case WindowsMessage.WINDOWPOSCHANGING:
                break;

            default:
                int enumValue = (int)callbackParam.message;
                switch (enumValue)
                {
                case 647:
                case 49666:
                    break;

                default:
                    Log.Info(callbackParam.message.ToString());
                    break;
                }
                break;
            }
            callNext = true;
            return(0);
        }
        /// <summary>
        /// OMG this method is awful!!! but yagni
        /// </summary>
        /// <param name="callbackParam"></param>
        private void WindowPositionChangedHandler(CallWindowProcedureParam callbackParam)
        {
            ApplicationDisplayMetrics appMetrics = null;

            if (monitorApplications == null ||
                !monitorApplications.ContainsKey(lastMetrics.Key))
            {
                Log.Error("No definitions found for this resolution: {0}", lastMetrics.Key);
                return;
            }

            appMetrics = monitorApplications[lastMetrics.Key]
                         .FirstOrDefault(row => row.Value.HWnd == callbackParam.hwnd)
                         .Value;

            if (appMetrics == null)
            {
                var newAppWindow = SystemWindow.AllToplevelWindows
                                   .FirstOrDefault(row => row.Parent.HWnd.ToInt64() == 0 &&
                                                   !string.IsNullOrEmpty(row.Title) &&
                                                   !row.Title.Equals("Program Manager") &&
                                                   row.Visible &&
                                                   row.HWnd == callbackParam.hwnd);

                if (newAppWindow == null)
                {
                    Log.Error("Can't find hwnd {0}", callbackParam.hwnd.ToInt64());
                    return;
                }
                ApplicationDisplayMetrics applicationDisplayMetric = null;
                AddOrUpdateWindow(lastMetrics.Key, newAppWindow, out applicationDisplayMetric);
                return;
            }

            WindowPlacement windowPlacement = appMetrics.WindowPlacement;
            WindowsPosition newPosition     = (WindowsPosition)Marshal.PtrToStructure(callbackParam.lparam, typeof(WindowsPosition));

            windowPlacement.NormalPosition.Left   = newPosition.Left;
            windowPlacement.NormalPosition.Top    = newPosition.Top;
            windowPlacement.NormalPosition.Right  = newPosition.Left + newPosition.Width;
            windowPlacement.NormalPosition.Bottom = newPosition.Top + newPosition.Height;

            var key = appMetrics.Key;

            if (monitorApplications[lastMetrics.Key].ContainsKey(key))
            {
                monitorApplications[lastMetrics.Key][appMetrics.Key].WindowPlacement = windowPlacement;
            }
            else
            {
                Log.Error("Hwnd {0} is not in list, we should capture", callbackParam.hwnd.ToInt64());
                return;
            }

            Log.Info("WPCH - Capturing {0} at [{1}x{2}] size [{3}x{4}]",
                     appMetrics,
                     appMetrics.WindowPlacement.NormalPosition.Left,
                     appMetrics.WindowPlacement.NormalPosition.Top,
                     appMetrics.WindowPlacement.NormalPosition.Width,
                     appMetrics.WindowPlacement.NormalPosition.Height
                     );
        }