protected static void ShowWindowMenu(HwndSource source, Point screenPoint, bool canMinimize)
        {
            var systemMetrics   = NativeMethods.GetSystemMetrics(40);
            var systemMenu      = NativeMethods.GetSystemMenu(source.Handle, false);
            var windowPlacement = NativeMethods.GetWindowPlacement(source.Handle);
            var flag            = VisualUtilities.ModifyStyle(source.Handle, 268435456, 0);
            var uEnable         = canMinimize ? 0U : 1U;

            if (windowPlacement.showCmd == 1)
            {
                NativeMethods.EnableMenuItem(systemMenu, 61728U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61456U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61440U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61488U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61472U, uEnable);
                NativeMethods.EnableMenuItem(systemMenu, 61536U, 0U);
            }
            else if (windowPlacement.showCmd == 3)
            {
                NativeMethods.EnableMenuItem(systemMenu, 61728U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61456U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61440U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61488U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61472U, uEnable);
                NativeMethods.EnableMenuItem(systemMenu, 61536U, 0U);
            }
            if (flag)
            {
                VisualUtilities.ModifyStyle(source.Handle, 0, 268435456);
            }
            var fuFlags = (uint)(systemMetrics | 256 | 128 | 2);
            var num     = NativeMethods.TrackPopupMenuEx(systemMenu, fuFlags, (int)screenPoint.X, (int)screenPoint.Y,
                                                         source.Handle, IntPtr.Zero);

            if (num == 0)
            {
                return;
            }
            NativeMethods.PostMessage(source.Handle, 274, new IntPtr(num), IntPtr.Zero);
        }