Ejemplo n.º 1
0
        /// <summary>
        ///     This is the hook to HwndSource that is called when window messages related to
        ///     this window occur.
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="msg"></param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <param name="handled"></param>
        /// <returns></returns>
        private IntPtr WindowFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            IntPtr        retInt  = IntPtr.Zero;
            WindowMessage message = (WindowMessage)msg;

            //
            // we need to process WM_GETMINMAXINFO before _swh is assigned to
            // b/c we want to store the max/min size allowed by win32 for the hwnd
            // which is later used in GetWindowMinMax.  WmGetMinMaxInfo can handle
            // _swh == null case.
            switch (message)
            {
            case WindowMessage.WM_APP:
                AddHandle(WinUser.GetForegroundWindow());
                break;
            }

            return(retInt);
        }