# Re: 拆出中文字的字码

Posted by cww on February 26, 1998 at 01:26:36:

In Reply to: 拆出中文字的字码 posted by 阿晴 on February 25, 1998 at 06:09:34:

ImmConfigure... 的就不行
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
原本我也以为不行，后来我觉得很奇怪，这个function在Api检视员所列，
与Delphi中Win API的说明，二者参数不一致，于是找了一下Delphi的
imm.pas 发现，尚有ImmConfigureIMEA()，其实VB要呼叫这个才能Work啦
宣告及testing程式如下，可以worrk
注: 原本的ImmConfigureIMEA()的宣告应如下：而testing程式为了传Null
有做修改
Declare Function ImmConfigureIMEA Lib "imm32.dll" (ByVal hkl As Long, ByVal hwnd As Long, ByVal dw As Long, _
lpData As Any) As Long

'testing program
Private Declare Function ImmConfigureIMEA Lib "imm32.dll" (ByVal hkl As Long, ByVal hwnd As Long, ByVal dw As Long, _
ByVal lpData As Long) As Long
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long

Private Sub Text1_DblClick()
Dim res As Long
Dim hkb5 As Long
'前题假设，text1目前的输入法是中文，才能work
hkb5 = GetKeyboardLayout(0)
res = ImmConfigureIMEA(hkb5, hwnd, 1, 0)
End Sub

Follow Ups: