I have a special char (/ @) that I want to convert to Keys.
I am currently using this:
Keys k = (Keys)'/';
And when debugging, I get that k is equal to:
LButton | RButton | MButton | Back | Space Type - System.Windows.Forms.Keys
k keycode should have been 111.
NOTE. The code works for uppercase letters, for example:
Keys k = (Keys)'Z';
In this case, k key code is 90, which is normal.
I am trying to find a way to convert special characters to Keys. (or their corresponding key code)
Trying to send keys globally with:
public static void SendKey(byte keycode) { const int KEYEVENTF_EXTENDEDKEY = 0x1; const int KEYEVENTF_KEYUP = 0x2; keybd_event(keycode, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0); keybd_event(keycode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0); } SendKey((byte)Keys.{SomethingHere});
user779444
source share