最近又為了客戶的需求,又要加入French的Keyboard
雖然之前有做過German的Keyboard,不過又全部忘記了... ~~
當初是怎麼做出那個DLL的 @@
重新複習了一下
首先 先用kbdgen (在 \wince500\public\common\oak\bin\i386下面)
然後把 Windows下的 kbdfr.dll ( \Windows\system32) copy 到kbdgen 的目錄下
下kbdgen的 command
法國區碼為 040C
結果如下
c:\wince500\public\common\oak\bin\i386\kbdgen kbdfr.dll -o cekbdfr -i 0000040C
kbdgen for Windows CE (Release) (Built on Dec 30 2003 15:22:20)
Warning - Generating desktop VK to CE VK conversions for the Input Language:
Warning - Desktop VK_OEM_6 assigned to CE VK_RBRACKET
Warning - Desktop VK_OEM_5 assigned to CE VK_BACKSLASH
Warning - Desktop VK_OEM_4 assigned to CE VK_LBRACKET
Warning - Desktop VK_OEM_PLUS assigned to CE VK_EQUAL
Warning - Desktop VK_OEM_1 assigned to CE VK_SEMICOLON
Warning - Desktop VK_OEM_7 assigned to CE VK_APOSTROPHE
Warning - Desktop VK_OEM_3 assigned to CE VK_BACKQUOTE
Warning - Desktop VK_OEM_COMMA assigned to CE VK_COMMA
Warning - Desktop VK_OEM_PERIOD assigned to CE VK_PERIOD
Warning - Desktop VK_OEM_2 assigned to CE VK_SLASH
Warning - Desktop VK_OEM_8 assigned to CE VK_OFF
Warning - Generating VKeyToXTScanCodeTable:
Warning - The following duplicate entries have been ignored
Warning - Virtual key VK_CLEAR (0x0C) - Scan code 0x59
Warning - Virtual key VK_TAB (0x09) - Scan code 0x7C
Warning - Virtual key VK_RETURN (0x0D) - Scan code 0xE01C
Warning - Generating desktop VK to CE VK conversions for the Device Layout:
Warning - Desktop VK_OEM_4 assigned to CE VK_LBRACKET
Warning - Desktop VK_OEM_PLUS assigned to CE VK_EQUAL
Warning - Desktop VK_OEM_6 assigned to CE VK_RBRACKET
Warning - Desktop VK_OEM_1 assigned to CE VK_SEMICOLON
Warning - Desktop VK_OEM_3 assigned to CE VK_BACKQUOTE
Warning - Desktop VK_OEM_7 assigned to CE VK_APOSTROPHE
Warning - Desktop VK_OEM_5 assigned to CE VK_BACKSLASH
Warning - Desktop VK_OEM_COMMA assigned to CE VK_COMMA
Warning - Desktop VK_OEM_PERIOD assigned to CE VK_PERIOD
Warning - Desktop VK_OEM_2 assigned to CE VK_SLASH
Warning - Desktop VK_OEM_8 assigned to CE VK_OFF
Warning - Desktop VK_OEM_WSCTRL no CE match
Warning - Desktop VK_OEM_FINISH assigned to CE VK_DBE_KATAKANA
Warning - Desktop VK_OEM_JUMP no CE match
Warning - Desktop VK_OEM_BACKTAB assigned to CE VK_DBE_ROMAN
Warning - Desktop VK_OEM_AUTO assigned to CE VK_DBE_SBCSCHAR
Warning - Desktop VK_OEM_PA3 no CE match
Warning - Desktop VK_OEM_RESET no CE match
Warning - Desktop VK_ABNT_C1 no CE match
Warning - Desktop VK_OEM_PA1 no CE match
Warning - Desktop VK_ABNT_C2 no CE match
Warning - Desktop VK_OEM_8 assigned to CE VK_OFF
會產生3個檔案
cekbdfr.reg
cekbdfrIL.cpp
cekbdfrDL.cpp
主要要export 2個函式出去
IL_0000040C
PS2_AT_0000040c
在platform builder help 中
How to Migrate a Keyboard Driver to Conform to the Layout Manager Interface
這個topic就是我們所要的
基本上 這個DLL要輸出以下一些函式
.def 的內容如下
LIBRARY LAYOUTMANAGER
EXPORTS
KeybdDriverInitializeEx
KeybdDriverPowerHandler
KeybdDriverGetInfo
KeybdDriverSetMode
KeybdDriverInitStates
KeybdDriverVKeyToUnicode
KeybdDriverMapVirtualKey
LayoutMgrGetKeyboardType
LayoutMgrGetKeyboardLayout
LayoutMgrGetKeyboardLayoutName
LayoutMgrGetKeyboardLayoutList
LayoutMgrLoadKeyboardLayout
LayoutMgrActivateKeyboardLayout
IL_0000040C
PS2_AT_0000040C
重點要Link的Library如下
LayoutManager.lib | Required |
Kbdmscommon.lib, or the library representing your keyboard PDD | Required |
Kbdpddlist.lib, or the library representing your PDD list | Required |
KeybdIst.lib | Required if you are using the generic IST from %_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\Ist |
InputLang_0409.lib, or the library representing the input languages | Required unless the input language is in a separate DLL |
PS2_AT_00000409.lib, or the library representing the device layouts | Required unless the device layout is in a separate DLL |
NumPadRmp.lib | Required if any of the device layout remapping functions use this library |
在nop (非8042) 下為
SOURCELIBS=\
$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\Nop_KbdCommon.lib \
$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\Nop_PddList.lib \
$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\LayoutManager.lib \
$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\kbdfr_lib.lib \ <---ps2_at_0000040c br=""> $(_COMM---ps2_at_0000040c>
ONOAKROOT)\lib\$(_CPUINDPATH)\NumPadRmp.lib \
$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\InputLang_040C.lib \
在dll目錄下照抄 KbdnopUS的 sources 這個檔案
把名字US的部份改成FR
把DOSYSGEN=1這行刪掉
才能build dll 否則會build出 kbdnopfr_lib.lib
2014新增
之前法文鍵盤沒有處理到 accents 的部份
http://french.about.com/od/pronunciation/a/accents.htm
French accents 有四種
accent aigu ´ (acute accent) can only be on an E.
accent grave ` (grave accent) can be found on an A, E, or U.
accent circonflexe ˆ (circumflex) can be on anA, E, I, O, or U.
accent tréma ¨ (dieresis or umlaut) can be on an E, I, or U.
在WINCE 處理的部份, 稱為 DeadKey
In laymgr.cpp
PFN_KEYBD_DRIVER_MAP_VIRTUAL_KEY KeybdDriverMapVirtualKey
call
PFN_KEYBD_DRIVER_VKEY_TO_UNICODE KeybdDriverVKeyToUnicode
call
static VKeyToUnicode
call
static GetCharacters
call
static ProcessLigature
call
static ProcessDeadKeys
Euro problem
在Unicode 中, euro sign 為 0x20AC
或者是 0x80 (depend on code page, 如 cp1252 )
要打出歐元 "應該"(未測試) 要在registry 內加上
[HKEY_LOCAL_MACHINE\nls]
"ExtraCurrency"=dword: 20ac
但是這個需要NLS support
所以用0x80 或許是另一個替代方法
但0x80 在某些非歐系國家中 不一定是euro sign
但Unicode 0x80 是euro sign
http://msdn.microsoft.com/en-us/library/aa448398.aspx