- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的应用程序必须显示系统中所有已安装的输入语言以及针对每种输入语言的键盘布局。
例如:
[InputLaguage]
Tamil
[Keyboard layouts]
US
Murasu Anjal
Tamil
English
US
我们可以从
获取安装的语言标识符和键盘布局标识符 GetKeyboardLayoutList(User32.dll)
通过拆分 LWORD 和 HWORD 的 API 函数。
但是我没有找到从键盘布局标识符中获取键盘布局名称的方法。从上面的示例中,我必须获取 US、Murasu Anjal 和 Tamil 来对抗泰米尔语。
请帮忙……
谢谢
最佳答案
这不是您问题的完整答案,但我花了几个小时手工编译了其中的大部分内容。它是每个布局代码到我的 Windows 7 版本可用的布局名称的映射。我不得不手写名字,所以请原谅那里的错别字。代码以编程方式收集。
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Input;
namespace DesktopDictation.DeviceButtonMappings
{
public class KeyboardLayout
{
const int KL_NAMELENGTH = 9;
[DllImport("user32.dll")]
private static extern long GetKeyboardLayoutName(StringBuilder pwszKLID);
//each keyboard layout is defined in Windows as a hex code
public static string GetLayoutCode()
{
var name = new StringBuilder(KL_NAMELENGTH);
GetKeyboardLayoutName(name);
return name.ToString();
}
//This is a mapping table from hex to descriptive name
public static String MapLayoutName(string code = null)
{
if (code == null)
code = GetLayoutCode();
switch (code)
{
case "0000041C":
return "Albanian";
case "00000401":
return "Arabic (101)";
case "00010401":
return "Arabic (102)";
case "00020401":
return "Arabic (102) Azerty";
case "0000042B":
return "Armenian eastern";
case "0001042B":
return "Armenian Western";
case "0000044D":
return "Assamese - inscript";
case "0000082C":
return "Azeri Cyrillic";
case "0000042C":
return "Azeri Latin";
case "0000046D":
return "Bashkir";
case "00000423":
return "Belarusian";
case "0000080C":
return "Belgian French";
case "00000813":
return "Belgian (period)";
case "0001080C":
return "Belgian (comma)";
case "00000445":
return "Bengali";
case "00010445":
return "Bengali - inscript (legacy)";
case "00020445":
return "Bengali - inscript";
case "0000201A":
return "Bosnian (cyrillic)";
case "00030402":
return "Bulgarian";
case "00000402":
return "Bulgarian(typewriter)";
case "00010402":
return "Bulgarian (latin)";
case "00020402":
return "Bulgarian (phonetic)";
case "00040402":
return "Bulgarian (phonetic traditional)";
case "00011009":
return "Canada Multilingual";
case "00001009":
return "Canada French";
case "00000C0C":
return "Canada French (legacy)";
case "00000404":
return "Chinese (traditional) - us keyboard";
case "00000804":
return "Chinese (simplified) -us keyboard";
case "00000C04":
return "Chinese (traditional, hong kong s.a.r.) - us keyboard";
case "00001004":
return "Chinese (simplified, singapore) - us keyboard";
case "00001404":
return "Chinese (traditional, macao s.a.r.) - us keyboard";
case "00000405":
return "Czech";
case "00020405":
return "Czech programmers";
case "00010405":
return "Czech (qwerty)";
case "0000041A":
return "Croatian";
case "00000439":
return "Deanagari - inscript";
case "00000406":
return "Danish";
case "00000465":
return "Divehi phonetic";
case "00010465":
return "Divehi typewriter";
case "00000413":
return "Dutch";
case "00000425":
return "Estonian";
case "00000438":
return "Faeroese";
case "0000040B":
return "Finnish";
case "0001083B":
return "Finnish with sami";
case "0000040C":
return "French";
case "00011809":
return "Gaelic";
case "00000437":
return "Georgian";
case "00020437":
return "Georgian (ergonomic)";
case "00010437":
return "Georgian (qwerty)";
case "00000407":
return "German";
case "00010407":
return "German (ibm)";
case "0000046F":
return "Greenlandic";
case "00000468":
return "Hausa";
case "0000040D":
return "Hebrew";
case "00010439":
return "Hindi traditional";
case "00000408":
return "Greek";
case "00010408":
return "Greek (220)";
case "00030408":
return "Greek (220) latin";
case "00020408":
return "Greek (319)";
case "00040408":
return "Greek (319) latin";
case "00050408":
return "Greek latin";
case "00060408":
return "Greek polyonic";
case "00000447":
return "Gujarati";
case "0000040E":
return "Hungarian";
case "0001040E":
return "Hungarian 101 key";
case "0000040F":
return "Icelandic";
case "00000470":
return "Igbo";
case "0000085D":
return "Inuktitut - latin";
case "0001045D":
return "Inuktitut - naqittaut";
case "00001809":
return "Irish";
case "00000410":
return "Italian";
case "00010410":
return "Italian (142)";
case "00000411":
return "Japanese";
case "0000044B":
return "Kannada";
case "0000043F":
return "Kazakh";
case "00000453":
return "Khmer";
case "00000412":
return "Korean";
case "00000440":
return "Kyrgyz cyrillic";
case "00000454":
return "Lao";
case "0000080A":
return "Latin america";
case "00000426":
return "Latvian";
case "00010426":
return "Latvian (qwerty)";
case "00010427":
return "Lithuanian";
case "00000427":
return "Lithuanian ibm";
case "00020427":
return "Lithuanian standard";
case "0000046E":
return "Luxembourgish";
case "0000042F":
return "Macedonian (fyrom)";
case "0001042F":
return "Macedonian (fyrom) - standard";
case "0000044C":
return "Malayalam";
case "0000043A":
return "Maltese 47-key";
case "0001043A":
return "Maltese 48-key";
case "0000044E":
return "Marathi";
case "00000481":
return "Maroi";
case "00000450":
return "Mongolian cyrillic";
case "00000850":
return "Mongolian (mongolian script)";
case "00000461":
return "Nepali";
case "00000414":
return "Norwegian";
case "0000043B":
return "Norwegian with sami";
case "00000448":
return "Oriya";
case "00000463":
return "Pashto (afghanistan)";
case "00000429":
return "Persian";
case "00000415":
return "Polish (programmers)";
case "00010415":
return "Polish (214)";
case "00000816":
return "Portuguese";
case "00000416":
return "Portuguese (brazillian abnt)";
case "00010416":
return "Portuguese (brazillian abnt2)";
case "00000446":
return "Punjabi";
case "00010418":
return "Romanian (standard)";
case "00000418":
return "Romanian (legacy)";
case "00020418":
return "Romanian (programmers)";
case "00000419":
return "Russian";
case "00010419":
return "Russian (typewriter)";
case "0002083B":
return "Sami extended finland-sweden";
case "0001043B":
return "Sami extended norway";
case "00000C1A":
return "Serbian (cyrillic)";
case "0000081A":
return "Serbian (latin)";
case "0000046C":
return "Sesotho sa Leboa";
case "00000432":
return "Setswana";
case "0000045B":
return "Sinhala";
case "0001045B":
return "Sinhala -Wij 9";
case "0000041B":
return "Slovak";
case "0001041B":
return "Slovak (qwerty)";
case "00000424":
return "Slovenian";
case "0001042E":
return "Sorbian extended";
case "0002042E":
return "Sorbian standard";
case "0000042E":
return "Sorbian standard (legacy)";
case "0000040A":
return "Spanish";
case "0001040A":
return "Spanish variation";
case "0000041D":
return "Swedish";
case "0000083B":
return "Swedish with sami";
case "00000807":
return "Swiss german";
case "0000100C":
return "Swiss french";
case "0000045A":
return "Syriac";
case "0001045A":
return "Syriac phonetic";
case "00000428":
return "Tajik";
case "00000449":
return "Tamil";
case "00000444":
return "Tatar";
case "0000044A":
return "Telugu";
case "0000041E":
return "Thai Kedmanee";
case "0002041E":
return "Thai Kedmanee (non-shiftlock)";
case "0001041E":
return "Thai Pattachote";
case "0003041E":
return "Thai Pattachote (non-shiftlock)";
case "00000451":
return "Tibetan (prc)";
case "0001041F":
return "Turkish F";
case "0000041F":
return "Turkish Q";
case "00000442":
return "Turkmen";
case "00000422":
return "Ukrainian";
case "00020422":
return "Ukrainian (enhanced)";
case "00000809":
return "United Kingdom";
case "00000452":
return "United Kingdom Extended";
case "00000409":
return "United States";
case "00010409":
return "United States - dvorak";
case "00030409":
return "United States - dvorak left hand";
case "00050409":
return "United States - dvorak right hand";
case "00004009":
return "United States - india";
case "00020409":
return "United States - international";
case "00000420":
return "Urdu";
case "00010480":
return "Uyghur";
case "00000480":
return "Uyghur (legacy)";
case "00000843":
return "Uzbek cyrillic";
case "0000042A":
return "Vietnamese";
case "00000485":
return "Yakut";
case "0000046A":
return "Yoruba";
case "00000488":
return "Wolof";
default:
return "unknown";
}
}
}
}
关于c# - 如何从键盘布局标识符中获取键盘布局名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14701095/
我需要您在以下方面提供帮助。近一个月来,我一直在阅读有关任务和异步的内容。 我想尝试在一个简单的 wep api 项目中实现我新获得的知识。我有以下方法,并且它们都按预期工作: public Htt
我的可执行 jar 中有一个模板文件 (.xls)。不需要在运行时我需要为这个文件创建 100 多个副本(稍后将唯一地附加)。用于获取 jar 文件中的资源 (template.xls)。我正在使用
我在查看网站的模型代码时对原型(prototype)有疑问。我知道这对 Javascript 中的继承很有用。 在这个例子中... define([], function () { "use
影响我性能的前三项操作是: 获取滚动条 获取偏移高度 Ext.getStyle 为了解释我的应用程序中发生了什么:我有一个网格,其中有一列在每个单元格中呈现网格。当我几乎对网格的内容做任何事情时,它运
我正在使用以下函数来获取 URL 参数。 function gup(name, url) { name = name.replace(/[\[]/, '\\\[').replace(/[\]]/,
我最近一直在使用 sysctl 来做很多事情,现在我使用 HW_MACHINE_ARCH 变量。我正在使用以下代码。请注意,当我尝试获取其他变量 HW_MACHINE 时,此代码可以完美运行。我还认为
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关闭 9 年前。 要求提供代码的问题必须表现出对所解决问题的最低限度的理解。包括尝试过的解决方案、为什么
由于使用 main-bower-files 作为使用 Gulp 的编译任务的一部分,我无法使用 node_modules 中的 webpack 来require 模块code> dir 因为我会弄乱当
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
我使用 Gridlayout 在一行中放置 4 个元素。首先,我有一个 JPanel,一切正常。对于行数变大并且我必须能够向下滚动的情况,我对其进行了一些更改。现在我的 JPanel 上添加了一个 J
由于以下原因,我想将 VolumeId 的值保存在变量中: #!/usr/bin/env python import boto3 import json import argparse import
我正在将 MSAL 版本 1.x 更新为 MSAL-browser 的 Angular 。所以我正在尝试从版本 1.x 迁移到 2.X.I 能够成功替换代码并且工作正常。但是我遇到了 acquireT
我知道有很多关于此的问题,例如 Getting daily averages with pandas和 How get monthly mean in pandas using groupby但我遇到
This is the query string that I am receiving in URL. Output url: /demo/analysis/test?startDate=Sat+
我正在尝试使用 javascript 中的以下代码访问 Geoserver 层 var gkvrtWmsSource =new ol.source.ImageWMS({ u
API 需要一个包含授权代码的 header 。这就是我到目前为止所拥有的: var fullUrl = 'https://api.ecobee.com/1/thermostat?json=\{"s
如何获取文件中的最后一个字符,如果是某个字符,则删除它而不将整个文件加载到内存中? 这就是我目前所拥有的。 using (var fileStream = new FileStream("file.t
我是这个社区的新手,想出了我的第一个问题。 我正在使用 JSP,我成功地创建了 JSP-Sites,它正在使用jsp:setParameter 和 jsp:getParameter 具有单个字符串。
在回答 StoreStore reordering happens when compiling C++ for x86 @Peter Cordes 写过 For Acquire/Release se
我有一个函数,我们将其命名为 X1,它返回变量 Y。该函数在操作 .on("focusout", X1) 中使用。如何获取变量Y?执行.on后X1的结果? 最佳答案 您可以更改 Y 的范围以使其位于函
我是一名优秀的程序员,十分优秀!