Windows Volume adjustment
Go to solution
Solved by Pinguinsan,
In WinForms, the KeyEventArgs.KeyValue (raw value) for the keys (at least on my machine) are:
VolumeMute: 0xAD (173)
VolumeDown: 0xAE (174)
VolumeUp : 0xAF (175)
You can confirm this on your machine if you have Visual Studio, just compile a simple C# WinForms application, put a button onto it (it will default to being named button1, then attach the KeyDown event to this block of code:
private void button1_KeyDown(Object sender, KeyEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Alt", e.Alt);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Control", e.Control);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "KeyCode", e.KeyCode);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "KeyValue", e.KeyValue);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "KeyData", e.KeyData);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Modifiers", e.Modifiers);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Shift", e.Shift);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SuppressKeyPress", e.SuppressKeyPress);
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "KeyDown Event");
}
Then run the application, place the mouse cursor over the button, and hit whatever button combination you want to know the code of.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now