public bool SearchProcess() { Process[] processList = Process.GetProcessesByName("Langrisser"); if (1 > processList.Length || 1 < processList.Length) { notifyIcon.Icon = Properties.Resources.Red; pictureBox_ProcessStatus.BackColor = Color.Red; if (null != _Process) { _Process.Dispose(); _Process = null; } button_Screenshot.Enabled = false; checkBox_Hide.Enabled = false; checkBox_IngameShortcut.Enabled = false; clientHideToolStripMenuItem.Enabled = false; 클라숨기기ToolStripMenuItem.Enabled = false; return(false); } if (null != _Process) { _Process.Dispose(); _Process = null; } _Process = processList[0]; _Process.EnableRaisingEvents = true; _Process.Exited += _Process_Exited; notifyIcon.Icon = Properties.Resources.Green; pictureBox_ProcessStatus.BackColor = Color.Lime; button_Screenshot.Enabled = true; checkBox_Hide.Enabled = true; checkBox_IngameShortcut.Enabled = true; clientHideToolStripMenuItem.Enabled = true; 클라숨기기ToolStripMenuItem.Enabled = true; if (Properties.Settings.Default.isRefreshMute) { trackBar_sound.Value = 0; button_mute.Image = Properties.Resources.Mute; _isMute = true; VolumeMixer.SetApplicationMute(_Process.Id, true); VolumeMixer.SetApplicationVolume(_Process.Id, 0f); } else { VolumeMixer.SetApplicationMute(_Process.Id, _isMute); VolumeMixer.SetApplicationVolume(_Process.Id, trackBar_sound.Value); } return(true); }
private void trackBar_sound_Scroll(object sender, EventArgs e) { if (null == _Process) { return; } if (0 == _Process.Id) { return; } VolumeMixer.SetApplicationVolume(_Process.Id, trackBar_sound.Value); }
// 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); }