コード例 #1
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.isBalloon     = checkBox_Tooltip.Checked;
            Properties.Settings.Default.isRefreshMute = checkBox_RefreshMute.Checked;

            Properties.Settings.Default.BossKeyModifiers = ModifiersCalc(_BossKey);
            Properties.Settings.Default.BossKey          = _BossKey.key;

            Properties.Settings.Default.VolumeUpModifiers = ModifiersCalc(_VolumeUp);
            Properties.Settings.Default.VolumeUpKey       = _VolumeUp.key;

            Properties.Settings.Default.VolumeDownModifiers = ModifiersCalc(_VolumeDown);
            Properties.Settings.Default.VolumeDownKey       = _VolumeDown.key;

            Properties.Settings.Default.MuteKeyModifiers = ModifiersCalc(_MuteKey);
            Properties.Settings.Default.MuteKey          = _MuteKey.key;

            Properties.Settings.Default.ScreenshotModifiers = ModifiersCalc(_ScreenshotKey);
            Properties.Settings.Default.ScreenshotKey       = _ScreenshotKey.key;

            Properties.Settings.Default.IngameShortcutModifiers = ModifiersCalc(_IngameShortcut);
            Properties.Settings.Default.IngameShortcutKey       = _IngameShortcut.key;

            Properties.Settings.Default.Skill1Key = _Skill1Key.key;
            Properties.Settings.Default.Skill2Key = _Skill2Key.key;
            Properties.Settings.Default.Skill3Key = _Skill3Key.key;
            Properties.Settings.Default.WaitKey   = _WaitKey.key;
            //Properties.Settings.Default.OKKey = _OKKey.key;
            Properties.Settings.Default.CancelKey = _CancelKey.key;


            Properties.Settings.Default.Save();

            _tm.HotKeyRegister();

            if (true == _tm.checkBox_IngameShortcut.Checked)
            {
                _tm.IngameShortCutKeyRegister();
                TaskManager.HookRegister();
            }

            this.Close();
        }
コード例 #2
0
        // Windows Message Catcher
        protected override void WndProc(ref Message message)
        {
            if (message.Msg == Win32.WM_HOTKEY)
            {
                Keys         key      = (Keys)(((int)message.LParam >> 16) & 0xFFFF);
                KeyModifiers modifier = (KeyModifiers)((int)message.LParam & 0xFFFF);

                // BossKey
                if ((KeyModifiers)(Properties.Settings.Default.BossKeyModifiers) == modifier && (Keys)(Properties.Settings.Default.BossKey) == key)
                {
                    if (null != _Process)
                    {
                        if (true == checkBox_Hide.Checked)
                        {
                            checkBox_Hide.Checked = false;
                        }
                        else
                        {
                            checkBox_Hide.Checked = true;
                        }
                    }
                }

                // Volume Up
                else if ((KeyModifiers)(Properties.Settings.Default.VolumeUpModifiers) == modifier && (Keys)(Properties.Settings.Default.VolumeUpKey) == key)
                {
                    if (100 - 5 < trackBar_sound.Value)
                    {
                        trackBar_sound.Value = 100;
                    }
                    else
                    {
                        trackBar_sound.Value += 5;
                    }

                    if (null != _Process)
                    {
                        VolumeMixer.SetApplicationVolume(_Process.Id, trackBar_sound.Value);
                    }
                }

                // Volume Down
                else if ((KeyModifiers)(Properties.Settings.Default.VolumeDownModifiers) == modifier && (Keys)(Properties.Settings.Default.VolumeDownKey) == key)
                {
                    if (5 > trackBar_sound.Value)
                    {
                        trackBar_sound.Value = 0;
                    }
                    else
                    {
                        trackBar_sound.Value -= 5;
                    }

                    if (null != _Process)
                    {
                        VolumeMixer.SetApplicationVolume(_Process.Id, trackBar_sound.Value);
                    }
                }

                // MuteKey
                else if ((KeyModifiers)(Properties.Settings.Default.MuteKeyModifiers) == modifier && (Keys)(Properties.Settings.Default.MuteKey) == key)
                {
                    if (true == _isMute)
                    {
                        _isMute           = false;
                        button_mute.Image = Properties.Resources.Speaker;
                        if (null != _Process)
                        {
                            VolumeMixer.SetApplicationMute(_Process.Id, false);
                        }
                    }
                    else
                    {
                        _isMute           = true;
                        button_mute.Image = Properties.Resources.Mute;
                        if (null != _Process)
                        {
                            VolumeMixer.SetApplicationMute(_Process.Id, true);
                        }
                    }
                }

                // Screenshot
                else if ((KeyModifiers)(Properties.Settings.Default.ScreenshotModifiers) == modifier && (Keys)(Properties.Settings.Default.ScreenshotKey) == key)
                {
                    Screenshot();
                }

                // IngameShortcut
                else if ((KeyModifiers)(Properties.Settings.Default.IngameShortcutModifiers) == modifier && (Keys)(Properties.Settings.Default.IngameShortcutKey) == key)
                {
                    if (null != _Process)
                    {
                        if (true == checkBox_IngameShortcut.Checked)
                        {
                            checkBox_IngameShortcut.Checked = false;
                        }
                        else
                        {
                            checkBox_IngameShortcut.Checked = true;
                        }
                    }
                }

                // Skill1
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.Skill1Key) == key)
                {
                    IngameHotKey(_LocSkill1);
                    _isSkillPush = true;
                }

                // Skill2
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.Skill2Key) == key)
                {
                    IngameHotKey(_LocSkill2);
                    _isSkillPush = true;
                }

                // Skill3
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.Skill3Key) == key)
                {
                    IngameHotKey(_LocSkill3);
                    _isSkillPush = true;
                }

                // OK
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.OKKey) == key)
                {
                    IngameHotKey(_LocOK);
                }

                // CANCEL
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.CancelKey) == key)
                {
                    IngameHotKey(_LocCancel);
                }

                // WAIT
                else if (KeyModifiers.None == modifier && (Keys)(Properties.Settings.Default.WaitKey) == key)
                {
                    IngameHotKey(_LocWait);
                }

                // ESC
                else if (KeyModifiers.None == modifier && Keys.Escape == key)
                {
                    if (null != _Process)
                    {
                        if (true == _isUsingChat)
                        {
                            _isUsingChat = false;

                            if (true == Properties.Settings.Default.isBalloon)
                            {
                                _this.notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                                _this.notifyIcon.BalloonTipTitle = "작업 관리자";
                                _this.notifyIcon.BalloonTipText  = "인게임 채팅모드 종료.";
                                _this.notifyIcon.ShowBalloonTip(2000);
                            }

                            _this.IngameShortCutKeyRegister();
                            Win32.UnregisterHotKey(_this.Handle, ESC_ID);
                        }
                    }

                    int info = 0;
                    Win32.keybd_event(Win32.VK_ESCAPE, 0, Win32.KE_DOWN, ref info);
                    Win32.keybd_event(Win32.VK_ESCAPE, 0, Win32.KE_UP, ref info);
                }
                else
                {
                    if (null == Properties.Settings.Default.ManualInagmeShortcutList)
                    {
                        Properties.Settings.Default.ManualInagmeShortcutList = new BindingList <UILocation>();
                    }

                    foreach (UILocation uiLocation in Properties.Settings.Default.ManualInagmeShortcutList)
                    {
                        if (KeyModifiers.None == modifier && uiLocation.key == key)
                        {
                            if (false == uiLocation.isUsing)
                            {
                                break;
                            }

                            IngameHotKey(uiLocation);
                            break;
                        }
                    }
                }
            }

            base.WndProc(ref message);
        }