Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何轻松地将vkeys ALT组合转换为文本?_C#_Raw Input - Fatal编程技术网

C# 如何轻松地将vkeys ALT组合转换为文本?

C# 如何轻松地将vkeys ALT组合转换为文本?,c#,raw-input,C#,Raw Input,我有条形码扫描器,可以在ALT键上写下所有字母和数字 id = new InputDevice(Handle); NumberOfKeyboards = id.EnumerateDevices(); id.KeyPressed += new InputDevice.DeviceEventHandler(m_KeyPressed); private void m_KeyPressed(object sender, InputDevi

我有条形码扫描器,可以在ALT键上写下所有字母和数字

        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;
这是我在网上找到的一个例子,我不能发布我程序的全部代码。 (磅=标签)

与:

我记录所有vkey事件。因此,如果我的扫描仪启动,我会得到类似这样的东西(例如)


我现在的问题是,有没有办法快速将其转换回去?用DLL之类的东西。

我现在明白了,我只是简单地捕获了字符串中的所有键,并将数字转换回ASCII码

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

我转换的是Unicode格式的数字。

你说的“ALT键上的所有字母数字”是什么意思?就像我有一个条形码,它只是说“你好”,条形码扫描器是作为HID键盘连接的,用ALT+Numpad组合来写HLO对不起,我还是不明白你的意思。这个答案对你有帮助吗?
MenuNumPad6Numpad5Return
                int unicode = int.Parse(MyConvert);
                char character = (char)unicode;
                Output = Output + character.ToString();