示例#1
0
        private void WindowGetMsg(object sender, WndProcEventArgs e)
        {
            long message = e.Message.ToInt64();

            if (message == NativeConstants.WM_SYSCOMMAND)
            {
                //string dbgMessage = string.Format("WM_SYSCOMMAND, Form, Handle = {0}, WParam = {1}", e.Handle, e.WParam);
                //System.Diagnostics.Trace.WriteLine(dbgMessage);
                Window window = _windows.FirstOrDefault(w => w.Handle == e.Handle);
                if (window != null)
                {
                    long lowOrder = e.WParam.ToInt64() & 0x0000FFFF;
                    switch (lowOrder)
                    {
                    case NativeConstants.SC_MAXIMIZE:
                    {
                        window.Menu.UncheckSizeMenu();
                    }
                    break;

                    case SystemMenu.SC_MINIMIZE_TO_SYSTEMTRAY:
                    {
                        window.MinimizeToSystemTray();
                    }
                    break;

                    case SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY:
                    {
                        bool r = window.Menu.IsMenuItemChecked(SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY);
                        window.Menu.CheckMenuItem(SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY, !r);
                    }
                    break;

                    case SystemMenu.SC_INFORMATION:
                    {
                        var infoForm = new InfoForm(window);
                        infoForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_SAVE_SCREEN_SHOT:
                    {
                        var bitmap = window.PrintWindow();
                        var dialog = new SaveFileDialog
                        {
                            OverwritePrompt  = true,
                            ValidateNames    = true,
                            Title            = "Save Window Screenshot",
                            FileName         = "WindowScreenshot",
                            DefaultExt       = "bmp",
                            RestoreDirectory = false,
                            Filter           = "Bitmap Image (*.bmp)|*.bmp|Gif Image (*.gif)|*.gif|JPEG Image (*.jpeg)|*.jpeg|Png Image (*.png)|*.png|Tiff Image (*.tiff)|*.tiff|Wmf Image (*.wmf)|*.wmf"
                        };
                        if (dialog.ShowDialog(window.Win32Window) == DialogResult.OK)
                        {
                            var fileExtension = Path.GetExtension(dialog.FileName).ToLower();
                            var imageFormat   = fileExtension == ".bmp" ? ImageFormat.Bmp :
                                                fileExtension == ".gif" ? ImageFormat.Gif :
                                                fileExtension == ".jpeg" ? ImageFormat.Jpeg :
                                                fileExtension == ".png" ? ImageFormat.Png :
                                                fileExtension == ".tiff" ? ImageFormat.Tiff : ImageFormat.Wmf;
                            bitmap.Save(dialog.FileName, imageFormat);
                        }
                    }
                    break;

                    case SystemMenu.SC_COPY_TEXT_TO_CLIPBOARD:
                    {
                        var text = window.ExtractText();
                        if (text != null)
                        {
                            Clipboard.SetText(text);
                        }
                    }
                    break;

                    case SystemMenu.SC_DRAG_BY_MOUSE:
                    {
                        var isChecked = window.Menu.IsMenuItemChecked(SystemMenu.SC_DRAG_BY_MOUSE);
                        window.Menu.CheckMenuItem(SystemMenu.SC_DRAG_BY_MOUSE, !isChecked);
                    }
                    break;

                    case SystemMenu.SC_OPEN_FILE_IN_EXPLORER:
                    {
                        try
                        {
                            var process = Process.Start("explorer.exe", "/select, " + window.Process.GetMainModuleFileName());
                            Window.ForceForegroundWindow(process.MainWindowHandle);
                        }
                        catch
                        {
                        }
                    }
                    break;

                    case SystemMenu.SC_MINIMIZE_OTHER_WINDOWS:
                    case SystemMenu.SC_CLOSE_OTHER_WINDOWS:
                    {
                        foreach (var process in Process.GetProcesses())
                        {
                            try
                            {
                                if (process.MainWindowHandle != IntPtr.Zero && process.MainWindowHandle != Handle && process.MainWindowHandle != window.Handle)
                                {
                                    if (process.ProcessName.ToLower() == "explorer")
                                    {
                                        foreach (var handle in process.GetWindowHandles().Where(x => x != window.Handle).ToList())
                                        {
                                            var builder = new StringBuilder(1024);
                                            NativeMethods.GetClassName(handle, builder, builder.Capacity);
                                            var className = builder.ToString().Trim();
                                            if (className == "CabinetWClass" || className == "ExplorerWClass")
                                            {
                                                if (lowOrder == SystemMenu.SC_CLOSE_OTHER_WINDOWS)
                                                {
                                                    NativeMethods.PostMessage(handle, NativeConstants.WM_CLOSE, 0, 0);
                                                }
                                                else
                                                {
                                                    NativeMethods.PostMessage(handle, NativeConstants.WM_SYSCOMMAND, NativeConstants.SC_MINIMIZE, 0);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (lowOrder == SystemMenu.SC_CLOSE_OTHER_WINDOWS)
                                        {
                                            NativeMethods.PostMessage(process.MainWindowHandle, NativeConstants.WM_CLOSE, 0, 0);
                                        }
                                        else
                                        {
                                            NativeMethods.PostMessage(process.MainWindowHandle, NativeConstants.WM_SYSCOMMAND, NativeConstants.SC_MINIMIZE, 0);
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    break;

                    case SystemMenu.SC_TOPMOST:
                    {
                        var isChecked = window.Menu.IsMenuItemChecked(SystemMenu.SC_TOPMOST);
                        window.Menu.CheckMenuItem(SystemMenu.SC_TOPMOST, !isChecked);
                        window.MakeTopMost(!isChecked);
                    }
                    break;

                    case SystemMenu.SC_SEND_TO_BOTTOM:
                    {
                        window.SendToBottom();
                    }
                    break;

                    case SystemMenu.SC_AERO_GLASS:
                    {
                        var isChecked = window.Menu.IsMenuItemChecked(SystemMenu.SC_AERO_GLASS);
                        var version   = Environment.OSVersion.Version;
                        if (version.Major == 6 && (version.Minor == 0 || version.Minor == 1))
                        {
                            window.AeroGlassForVistaAndSeven(!isChecked);
                            window.Menu.CheckMenuItem(SystemMenu.SC_AERO_GLASS, !isChecked);
                        }
                        else if (version.Major >= 6)
                        {
                            window.AeroGlassForEightAndHigher(!isChecked);
                            window.Menu.CheckMenuItem(SystemMenu.SC_AERO_GLASS, !isChecked);
                        }
                    }
                    break;

                    case SystemMenu.SC_ROLLUP:
                    {
                        var isChecked = window.Menu.IsMenuItemChecked(SystemMenu.SC_ROLLUP);
                        window.Menu.CheckMenuItem(SystemMenu.SC_ROLLUP, !isChecked);
                        if (!isChecked)
                        {
                            window.RollUp();
                            window.Menu.UncheckMenuItems(
                                SystemMenu.SC_SIZE_640_480,
                                SystemMenu.SC_SIZE_720_480,
                                SystemMenu.SC_SIZE_720_576,
                                SystemMenu.SC_SIZE_800_600,
                                SystemMenu.SC_SIZE_1024_768,
                                SystemMenu.SC_SIZE_1152_864,
                                SystemMenu.SC_SIZE_1280_768,
                                SystemMenu.SC_SIZE_1280_800,
                                SystemMenu.SC_SIZE_1280_960,
                                SystemMenu.SC_SIZE_1280_1024,
                                SystemMenu.SC_SIZE_1440_900,
                                SystemMenu.SC_SIZE_1600_900,
                                SystemMenu.SC_SIZE_1680_1050,
                                SystemMenu.SC_SIZE_DEFAULT,
                                SystemMenu.SC_SIZE_CUSTOM);
                        }
                        else
                        {
                            window.UnRollUp();
                        }
                    }
                    break;


                    case SystemMenu.SC_SIZE_DEFAULT:
                    {
                        window.Menu.UncheckSizeMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_SIZE_DEFAULT, true);
                        window.ShowNormal();
                        window.RestoreSize();
                        window.Menu.UncheckMenuItems(SystemMenu.SC_ROLLUP);
                    }
                    break;

                    case SystemMenu.SC_SIZE_CUSTOM:
                    {
                        var sizeForm = new SizeForm(window);
                        sizeForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_TRANS_DEFAULT:
                    {
                        window.Menu.UncheckTransparencyMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_TRANS_DEFAULT, true);
                        window.RestoreTransparency();
                    }
                    break;

                    case SystemMenu.SC_TRANS_CUSTOM:
                    {
                        var opacityForm = new TransparencyForm(window);
                        opacityForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_ALIGN_DEFAULT:
                    {
                        window.Menu.UncheckAlignmentMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_ALIGN_DEFAULT, true);
                        window.RestorePosition();
                    }
                    break;

                    case SystemMenu.SC_ALIGN_CUSTOM:
                    {
                        var positionForm = new PositionForm(window);
                        positionForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_ALIGN_MONITOR:
                    {
                        var screenForm = new ScreenForm(window);
                        screenForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_SIZE_640_480: SetSizeMenuItem(window, SystemMenu.SC_SIZE_640_480, 640, 480); break;

                    case SystemMenu.SC_SIZE_720_480: SetSizeMenuItem(window, SystemMenu.SC_SIZE_720_480, 720, 480); break;

                    case SystemMenu.SC_SIZE_720_576: SetSizeMenuItem(window, SystemMenu.SC_SIZE_720_576, 720, 576); break;

                    case SystemMenu.SC_SIZE_800_600: SetSizeMenuItem(window, SystemMenu.SC_SIZE_800_600, 800, 600); break;

                    case SystemMenu.SC_SIZE_1024_768: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1024_768, 1024, 768); break;

                    case SystemMenu.SC_SIZE_1152_864: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1152_864, 1152, 864); break;

                    case SystemMenu.SC_SIZE_1280_768: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_768, 1280, 768); break;

                    case SystemMenu.SC_SIZE_1280_800: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_800, 1280, 800); break;

                    case SystemMenu.SC_SIZE_1280_960: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_960, 1280, 960); break;

                    case SystemMenu.SC_SIZE_1280_1024: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_1024, 1280, 1024); break;

                    case SystemMenu.SC_SIZE_1440_900: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1440_900, 1440, 900); break;

                    case SystemMenu.SC_SIZE_1600_900: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1600_900, 1600, 900); break;

                    case SystemMenu.SC_SIZE_1680_1050: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1680_1050, 1680, 1050); break;

                    case SystemMenu.SC_TRANS_100: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_100, 100); break;

                    case SystemMenu.SC_TRANS_90: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_90, 90); break;

                    case SystemMenu.SC_TRANS_80: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_80, 80); break;

                    case SystemMenu.SC_TRANS_70: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_70, 70); break;

                    case SystemMenu.SC_TRANS_60: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_60, 60); break;

                    case SystemMenu.SC_TRANS_50: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_50, 50); break;

                    case SystemMenu.SC_TRANS_40: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_40, 40); break;

                    case SystemMenu.SC_TRANS_30: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_30, 30); break;

                    case SystemMenu.SC_TRANS_20: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_20, 20); break;

                    case SystemMenu.SC_TRANS_10: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_10, 10); break;

                    case SystemMenu.SC_TRANS_00: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_00, 0); break;

                    case SystemMenu.SC_PRIORITY_REAL_TIME: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_REAL_TIME, Priority.RealTime); break;

                    case SystemMenu.SC_PRIORITY_HIGH: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_HIGH, Priority.High); break;

                    case SystemMenu.SC_PRIORITY_ABOVE_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_ABOVE_NORMAL, Priority.AboveNormal); break;

                    case SystemMenu.SC_PRIORITY_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_NORMAL, Priority.Normal); break;

                    case SystemMenu.SC_PRIORITY_BELOW_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_BELOW_NORMAL, Priority.BelowNormal); break;

                    case SystemMenu.SC_PRIORITY_IDLE: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_IDLE, Priority.Idle); break;

                    case SystemMenu.SC_ALIGN_TOP_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_LEFT, WindowAlignment.TopLeft); break;

                    case SystemMenu.SC_ALIGN_TOP_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_CENTER, WindowAlignment.TopCenter); break;

                    case SystemMenu.SC_ALIGN_TOP_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_RIGHT, WindowAlignment.TopRight); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_LEFT, WindowAlignment.MiddleLeft); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_CENTER, WindowAlignment.MiddleCenter); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_RIGHT, WindowAlignment.MiddleRight); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_LEFT, WindowAlignment.BottomLeft); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_CENTER, WindowAlignment.BottomCenter); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_RIGHT, WindowAlignment.BottomRight); break;
                    }

                    for (int i = 0; i < _settings.MenuItems.StartProgramItems.Count; i++)
                    {
                        if (lowOrder - SystemMenu.SC_START_PROGRAM == i)
                        {
                            var processStartInfo = new ProcessStartInfo();
                            processStartInfo.FileName         = _settings.MenuItems.StartProgramItems[i].FileName;
                            processStartInfo.WorkingDirectory = Path.GetDirectoryName(_settings.MenuItems.StartProgramItems[i].FileName);
                            processStartInfo.Arguments        = _settings.MenuItems.StartProgramItems[i].Arguments;
                            Process.Start(processStartInfo);
                            break;
                        }
                    }
                }
            }
        }
示例#2
0
        private void WindowGetMsg(object sender, WndProcEventArgs e)
        {
            long message = e.Message.ToInt64();

            if (message == NativeConstants.WM_SYSCOMMAND)
            {
                //string dbgMessage = string.Format("WM_SYSCOMMAND, Form, Handle = {0}, WParam = {1}", e.Handle, e.WParam);
                //System.Diagnostics.Trace.WriteLine(dbgMessage);
                Window window = _windows.FirstOrDefault(w => w.Handle == e.Handle);
                if (window != null)
                {
                    long lowOrder = e.WParam.ToInt64() & 0x0000FFFF;
                    switch (lowOrder)
                    {
                    case NativeConstants.SC_MAXIMIZE:
                    {
                        window.Menu.UncheckSizeMenu();
                    }
                    break;

                    case SystemMenu.SC_MINIMIZE_TO_SYSTEMTRAY:
                    {
                        window.MinimizeToSystemTray();
                    }
                    break;

                    case SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY:
                    {
                        bool r = window.Menu.IsMenuItemChecked(SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY);
                        window.Menu.CheckMenuItem(SystemMenu.SC_MINIMIZE_ALWAYS_TO_SYSTEMTRAY, !r);
                    }
                    break;

                    case SystemMenu.SC_INFORMATION:
                    {
                        var infoForm = new InfoForm(window);
                        infoForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_SAVE_SCREEN_SHOT:
                    {
                        var bitmap = window.PrintWindow();
                        var dialog = new SaveFileDialog
                        {
                            OverwritePrompt  = true,
                            ValidateNames    = true,
                            Title            = "Save Window Screenshot",
                            FileName         = "WindowScreenshot",
                            DefaultExt       = "bmp",
                            RestoreDirectory = false,
                            Filter           = "Bitmap Image (.bmp)|*.bmp|Gif Image (.gif)|*.gif|JPEG Image (.jpeg)|*.jpeg|Png Image (.png)|*.png|Tiff Image (.tiff)|*.tiff|Wmf Image (.wmf)|*.wmf"
                        };
                        if (dialog.ShowDialog(window.Win32Window) == DialogResult.OK)
                        {
                            var fileExtension = Path.GetExtension(dialog.FileName).ToLower();
                            var imageFormat   = fileExtension == ".bmp" ? ImageFormat.Bmp :
                                                fileExtension == ".gif" ? ImageFormat.Gif :
                                                fileExtension == ".jpeg" ? ImageFormat.Jpeg :
                                                fileExtension == ".png" ? ImageFormat.Png :
                                                fileExtension == ".tiff" ? ImageFormat.Tiff : ImageFormat.Wmf;
                            bitmap.Save(dialog.FileName, imageFormat);
                        }
                    }
                    break;

                    case SystemMenu.SC_COPY_TEXT_TO_CLIPBOARD:
                    {
                        var text = window.ExtractText();
                        if (text != null)
                        {
                            Clipboard.SetText(text);
                        }
                    }
                    break;

                    case SystemMenu.SC_TOPMOST:
                    {
                        bool r = window.Menu.IsMenuItemChecked(SystemMenu.SC_TOPMOST);
                        window.Menu.CheckMenuItem(SystemMenu.SC_TOPMOST, !r);
                        window.MakeTopMost(!r);
                    }
                    break;

                    case SystemMenu.SC_ROLLUP:
                    {
                        bool r = window.Menu.IsMenuItemChecked(SystemMenu.SC_ROLLUP);
                        window.Menu.CheckMenuItem(SystemMenu.SC_ROLLUP, !r);
                        if (!r)
                        {
                            window.RollUp();
                        }
                        else
                        {
                            window.UnRollUp();
                        }
                    }
                    break;


                    case SystemMenu.SC_SIZE_DEFAULT:
                    {
                        window.Menu.UncheckSizeMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_SIZE_DEFAULT, true);
                        window.ShowNormal();
                        window.RestoreSize();
                    }
                    break;

                    case SystemMenu.SC_SIZE_CUSTOM:
                    {
                        var sizeForm = new SizeForm(window);
                        sizeForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_TRANS_DEFAULT:
                    {
                        window.Menu.UncheckTransparencyMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_TRANS_DEFAULT, true);
                        window.RestoreTransparency();
                    }
                    break;

                    case SystemMenu.SC_TRANS_CUSTOM:
                    {
                        var opacityForm = new TransparencyForm(window);
                        opacityForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_ALIGN_DEFAULT:
                    {
                        window.Menu.UncheckAlignmentMenu();
                        window.Menu.CheckMenuItem(SystemMenu.SC_ALIGN_DEFAULT, true);
                        window.RestorePosition();
                    }
                    break;

                    case SystemMenu.SC_ALIGN_CUSTOM:
                    {
                        var positionForm = new PositionForm(window);
                        positionForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_ALIGN_MONITOR:
                    {
                        var screenForm = new ScreenForm(window);
                        screenForm.Show(window.Win32Window);
                    }
                    break;

                    case SystemMenu.SC_SIZE_640_480: SetSizeMenuItem(window, SystemMenu.SC_SIZE_640_480, 640, 480); break;

                    case SystemMenu.SC_SIZE_720_480: SetSizeMenuItem(window, SystemMenu.SC_SIZE_720_480, 720, 480); break;

                    case SystemMenu.SC_SIZE_720_576: SetSizeMenuItem(window, SystemMenu.SC_SIZE_720_576, 720, 576); break;

                    case SystemMenu.SC_SIZE_800_600: SetSizeMenuItem(window, SystemMenu.SC_SIZE_800_600, 800, 600); break;

                    case SystemMenu.SC_SIZE_1024_768: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1024_768, 1024, 768); break;

                    case SystemMenu.SC_SIZE_1152_864: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1152_864, 1152, 864); break;

                    case SystemMenu.SC_SIZE_1280_768: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_768, 1280, 768); break;

                    case SystemMenu.SC_SIZE_1280_800: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_800, 1280, 800); break;

                    case SystemMenu.SC_SIZE_1280_960: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_960, 1280, 960); break;

                    case SystemMenu.SC_SIZE_1280_1024: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1280_1024, 1280, 1024); break;

                    case SystemMenu.SC_SIZE_1440_900: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1440_900, 1440, 900); break;

                    case SystemMenu.SC_SIZE_1600_900: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1600_900, 1600, 900); break;

                    case SystemMenu.SC_SIZE_1680_1050: SetSizeMenuItem(window, SystemMenu.SC_SIZE_1680_1050, 1680, 1050); break;

                    case SystemMenu.SC_TRANS_100: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_100, 100); break;

                    case SystemMenu.SC_TRANS_90: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_90, 90); break;

                    case SystemMenu.SC_TRANS_80: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_80, 80); break;

                    case SystemMenu.SC_TRANS_70: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_70, 70); break;

                    case SystemMenu.SC_TRANS_60: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_60, 60); break;

                    case SystemMenu.SC_TRANS_50: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_50, 50); break;

                    case SystemMenu.SC_TRANS_40: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_40, 40); break;

                    case SystemMenu.SC_TRANS_30: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_30, 30); break;

                    case SystemMenu.SC_TRANS_20: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_20, 20); break;

                    case SystemMenu.SC_TRANS_10: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_10, 10); break;

                    case SystemMenu.SC_TRANS_00: SetTransparencyMenuItem(window, SystemMenu.SC_TRANS_00, 0); break;

                    case SystemMenu.SC_PRIORITY_REAL_TIME: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_REAL_TIME, Priority.RealTime); break;

                    case SystemMenu.SC_PRIORITY_HIGH: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_HIGH, Priority.High); break;

                    case SystemMenu.SC_PRIORITY_ABOVE_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_ABOVE_NORMAL, Priority.AboveNormal); break;

                    case SystemMenu.SC_PRIORITY_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_NORMAL, Priority.Normal); break;

                    case SystemMenu.SC_PRIORITY_BELOW_NORMAL: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_BELOW_NORMAL, Priority.BelowNormal); break;

                    case SystemMenu.SC_PRIORITY_IDLE: SetPriorityMenuItem(window, SystemMenu.SC_PRIORITY_IDLE, Priority.Idle); break;

                    case SystemMenu.SC_ALIGN_TOP_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_LEFT, WindowAlignment.TopLeft); break;

                    case SystemMenu.SC_ALIGN_TOP_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_CENTER, WindowAlignment.TopCenter); break;

                    case SystemMenu.SC_ALIGN_TOP_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_TOP_RIGHT, WindowAlignment.TopRight); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_LEFT, WindowAlignment.MiddleLeft); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_CENTER, WindowAlignment.MiddleCenter); break;

                    case SystemMenu.SC_ALIGN_MIDDLE_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_MIDDLE_RIGHT, WindowAlignment.MiddleRight); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_LEFT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_LEFT, WindowAlignment.BottomLeft); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_CENTER: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_CENTER, WindowAlignment.BottomCenter); break;

                    case SystemMenu.SC_ALIGN_BOTTOM_RIGHT: SetAlignmentMenuItem(window, SystemMenu.SC_ALIGN_BOTTOM_RIGHT, WindowAlignment.BottomRight); break;
                    }
                }
            }
        }