How convert easily vkeys ALT Combination to text?

139 Views Asked by At

I have BarCode Scanner which writes all letters numbers over the ALT Key.

        id = new InputDevice(Handle);
        NumberOfKeyboards = id.EnumerateDevices();
        id.KeyPressed += new InputDevice.DeviceEventHandler(m_KeyPressed);

        private void m_KeyPressed(object sender, InputDevice.KeyControlEventArgs e)
    {

        lbHandle2.Text = e.Keyboard.deviceHandle.ToString();
        lbType.Text = e.Keyboard.deviceType;
        lbName.Text = e.Keyboard.deviceName.Replace("&", "&&");
        lbDescription.Text = e.Keyboard.Name;
        lbKey.Text = e.Keyboard.key.ToString();
        lbNumKeyboards.Text = NumberOfKeyboards.ToString();
        lbVKey.Text = e.Keyboard.vKey;

This is example out internet i found, i cant post my whole code of my Programm. (lb = label)

With:

MyPath = MyPath + lbVKey.Text;

i log all my vkey events. So if my Scanner starts i get somthing like this (for A as Example)

MenuNumPad6Numpad5Return

My question is now, is there a way to quick convert it back? With DLL or something.

1

There are 1 best solutions below

0
On

I figured it out now i just simple catched all keys in string and converted the number to ASCII back.

                int unicode = int.Parse(MyConvert);
                char character = (char)unicode;
                Output = Output + character.ToString();

MyConvert are the Numbers which are Unicode.