Tuesday 15 March 2011

c# ascii to keycode? -



c# ascii to keycode? -

[dllimport("user32.dll")] private static extern short vkkeyscan(char ch); set = set + "\r\n"; int txl = set.length; (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 , keyboard layout keycode , how can convert other unicodes chinese , symbols in ascii ? doesn't work shift keys : "! , @ , # , $ ..." so, how can combine alt , other key , convert keycode ? e.g alt+33 = "!" , keycode = 0xf0

the alt code decimal representation of hex value of unicode symbol. illustration if check official chart see value ! 0021 if convert hex decimal 33 , alt + numpad-3 + numpad-3 comes from.

you can every possible unicode keycode value looking @ appropriate pdf http://www.unicode.org/charts

c# ascii converter keycode

No comments:

Post a Comment