0

I need to send "Volume Up" key with SendKeys Class. But I don't know what is the code for that key.

There is a list with key-codes, but there is no info about "Volume Up" key:

https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netframework-4.8

(And I'm also searching for "Volume Down" and "Volume Mute")

bessarabov
  • 11,151
  • 10
  • 34
  • 59
  • 1
    Does this answer your question? [How to control Windows system volume using JScript or VBScript?](https://stackoverflow.com/questions/2216334/how-to-control-windows-system-volume-using-jscript-or-vbscript) – GSerg May 28 '20 at 14:55
  • 1
    Wrong class. https://stackoverflow.com/questions/19157609/keybd-event-along-with-postmessage-win32-not-working-when-visual-studio-has-focu – Hans Passant May 28 '20 at 14:56
  • Thank you, but that links does not solve my issue. I'm using software IOTLink and I need to send that 'Volume UP' key to it (https://gitlab.com/iotlink/iotlink/-/wikis/Addons/Commands section "Send Keys") – bessarabov May 28 '20 at 15:04

1 Answers1

1

This is not supported by the SendKeys class. The documentation is correct.

You can also check the implementation to see what is supported.

For any code not contained in the allowed key list and not representing a single character, you will get an ArgumentException.

Use native Windows messages for sending that key to an application, as @HansPassant suggests in his comment. Here is his very helpful explanation how to do this.

You could also try third-party Windows input simulation solutions, like e.g. this open source WindowsInput library.

dymanoid
  • 14,771
  • 4
  • 36
  • 64