diff options
author | matthewsotoudeh <matthewsot@outlook.com> | 2014-12-03 20:41:04 -0800 |
---|---|---|
committer | matthewsotoudeh <matthewsot@outlook.com> | 2014-12-03 20:41:04 -0800 |
commit | bddc21d5f6fe992f00bbedef0439c193c2090b79 (patch) | |
tree | 2971c989c0e057ccb9d43f10cb171fcc00638ff0 | |
parent | f50d6a36262f4e3781a79e66ab6e09c74ac087fb (diff) |
starts hidden
press scroll lock to bring it back up
-rw-r--r-- | AntiVol/AntiVol/AntiVol.csproj | 6 | ||||
-rw-r--r-- | AntiVol/AntiVol/Form1.Designer.cs | 6 | ||||
-rw-r--r-- | AntiVol/AntiVol/Form1.cs | 18 |
3 files changed, 19 insertions, 11 deletions
diff --git a/AntiVol/AntiVol/AntiVol.csproj b/AntiVol/AntiVol/AntiVol.csproj index 3d9ba10..3b30b20 100644 --- a/AntiVol/AntiVol/AntiVol.csproj +++ b/AntiVol/AntiVol/AntiVol.csproj @@ -32,12 +32,6 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="AudioSwitcher.AudioApi"> - <HintPath>..\packages\AudioSwitcher.AudioApi.CoreAudio.1.2.2\lib\net40\AudioSwitcher.AudioApi.dll</HintPath> - </Reference> - <Reference Include="AudioSwitcher.AudioApi.CoreAudio"> - <HintPath>..\packages\AudioSwitcher.AudioApi.CoreAudio.1.2.2\lib\net40\AudioSwitcher.AudioApi.CoreAudio.dll</HintPath> - </Reference> <Reference Include="NAudio"> <HintPath>..\packages\NAudio.1.7.2\lib\net35\NAudio.dll</HintPath> </Reference> diff --git a/AntiVol/AntiVol/Form1.Designer.cs b/AntiVol/AntiVol/Form1.Designer.cs index b8d7c9b..2246cbf 100644 --- a/AntiVol/AntiVol/Form1.Designer.cs +++ b/AntiVol/AntiVol/Form1.Designer.cs @@ -38,7 +38,7 @@ this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; - this.button1.Text = "button1"; + this.button1.Text = "Enable"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -48,7 +48,7 @@ this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 1; - this.button2.Text = "button2"; + this.button2.Text = "Disable"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // @@ -60,7 +60,9 @@ this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form1"; + this.ShowInTaskbar = false; this.Text = "Form1"; + this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.ResumeLayout(false); } diff --git a/AntiVol/AntiVol/Form1.cs b/AntiVol/AntiVol/Form1.cs index 67a3c64..0df68b8 100644 --- a/AntiVol/AntiVol/Form1.cs +++ b/AntiVol/AntiVol/Form1.cs @@ -13,9 +13,19 @@ namespace AntiVol Program.hook.KeyIntercepted += Hook_KeyIntercepted; } + private bool enabled = true; + private bool Hook_KeyIntercepted(KeyboardHook.KeyboardHookEventArgs e) { - if (!e.KeyName.Contains("Volume")) return true; + if (!enabled) return true; + if (!e.KeyName.Contains("Volume") && e.KeyName != "Scroll") return true; + + if (e.KeyName == "Scroll") + { + //TODO: make it a taskbar thing + WindowState = FormWindowState.Normal; //using scroll lock as the hotkey for this, as I never have any other use for it + return false; + } //Thanks! https://stackoverflow.com/questions/2534595/get-master-sound-volume-in-c-sharp MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); @@ -31,6 +41,8 @@ namespace AntiVol case "VolumeMute": defaultDevice.AudioEndpointVolume.Mute = !defaultDevice.AudioEndpointVolume.Mute; break; + case "MediaNextTrack": + break; } return false; } @@ -39,12 +51,12 @@ namespace AntiVol private void button1_Click(object sender, EventArgs e) { - + enabled = true; } private void button2_Click(object sender, EventArgs e) { - + enabled = false; } } } |