[DllImport("user32.dll")]
private static extern short VkKeyScan(char ch);
set = set + "\r\n";
int txL = set.Length;
for (int o = 1; o < (txL); o++)
{
short vkey = VkKeyScan(set[o]); //MessageBox.Show(vkey.ToString());
Keys retval = (Keys)(vkey & 0xff);
int modifiers = vkey >> 8;
if ((modifiers & 1) != 0) retval |= Keys.Shift;
if ((modifiers & 2) != 0) retval |= Keys.Control;
if ((modifiers & 4) != 0) retval |= Keys.Alt;
}
This functions convert standard Alphabet and Keyboard Layout to KeyCode , how can i Convert all other Unicodes as Chinese and also symbols in ASCII ? it doesn't work also for shift keys : "! , @ , # , $ ..."
So, How can combine ALT and other Key and then convert to KeyCode ? e.g ALT+33 = "!" and KeyCode = 0xF0
The ALT code is just the decimal representation of the hex value of the Unicode symbol. For example if you check the official chart you will see that the value for
!
is0021
if you convert that from hex to decimal you get33
and that is where the alt + numPad-3 + numPad-3 comes from.You can get every possible Unicode keycode value from looking at the appropriate PDF from http://www.unicode.org/charts