Imm_Prop
引言:MSDN中關於Imm的說明太簡略了,而且英文的看不太懂。爲此我特地編寫了一些小程序測試Imm API,終於被我搞清楚了。
WM_INPUTLANGCHANGE
簡介:當窗口接收到WM_INPUTLANGCHANGE消息時,表示輸入法發生了改變。
聲明:#define WM_INPUTLANGCHANGE 0x0051
wParam:該輸入法使用的字符集。提示:可以使用TranslateCharsetInfo這個API得到字符集的信息。
lParam:該輸入法的HKL(KeyboardLayout——鍵盤佈局,也被稱爲 Input locale identifier —— 輸入區域標識)。
備註:此時可以調用ImmGetDescription取得輸入法名,可以調用ImmGetIMEFileName得到該輸入法的文件位置……最重要的是使用ImmGetProperty得到輸入法屬性。
ImmGetProperty
簡介:取得輸入法的屬性(特性)。MSDN: The ImmGetProperty function retrieves the property and capabilities of the IME associated with the specified input locale.
原形:DWORD ImmGetProperty(HKL hKL, DWORD fdwIndex);
hKL:輸入法的HKL。
fdwIndex:返回哪種屬性。是這些值:
[ -4]IGP_GETIMEVERSION:輸入法接口所使用的版本。MSDN: Retrieves the system version number for which the specified IME was created.
[0x04]IGP_PROPERTY:輸入屬性。MSDN: Property information.
[0x08]IGP_CONVERSION:組字屬性。MSDN: Conversion capabilities.
[0x0C]IGP_SENTENCE:組句屬性。MSDN: Sentence mode capabilities.
[0x10]IGP_UI:用戶界面(主要是文本旋轉特性)。MSDN: User interface capabilities.
[0x14]IGP_SETCOMPSTR:設置組字串的能力。MSDN: Composition string capabilities.
[0x18]IGP_SELECT:切換輸入法的繼承特性。MSDN: Selection inheritance capabilities.
返回值:該輸入法屬性。根據fdwIndex所填的常數而返回不同的屬性:
IGP_GETIMEVERSION:
[0x0003000A]IMEVER_0310:該輸入法基於 Windows 3.1。MSDN: The IME was created for Windows 3.1
[0x00040000]IMEVER_0400:該輸入法基於 Windows 9X(不要奇怪,現在WinXP改用TSF了)。MSDN: The IME was created for Windows 95/98/Me.
IGP_PROPERTY:
[0x00010000]IME_PROP_AT_CARET:組字窗口在插入符(caret,文本光標所在位置)附近(如微軟拼音、紫光拼音)。MSDN: If set, conversion window is at the caret position. If clear, the window is near caret position.
[0x00020000]IME_PROP_SPECIAL_UI:該輸入法有自己的特殊窗口(如微軟拼音、紫光拼音),應用程序不能自己繪製輸入法窗口。MSDN: If set, IME has a nonstandard user interface. The application should not draw in the IME window.
[0x00040000]IME_PROP_CANDLIST_START_FROM_1:(使用時)候選窗口中的列表是從1開始編號的。MSDN: If set, strings in the candidate list are numbered starting at 1. If clear, strings start at 0.
[0x00080000]IME_PROP_UNICODE:該輸入法是支持Unicode的。MSDN: If set, the IME is viewed as a Unicode IME. The system and the IME will communicate through the Unicode IME interface. If clear, IME will use the ANSI interface to communicate with the system.
[0x00100000]IME_PROP_COMPLETE_ON_UNSELECT:當窗口失去焦點時,也將當前輸入字符串提交。MSDN: Windows 98/Me, Windows 2000/XP: If set, the IME will complete the composition string when the IME is deactivated. If clear, the IME will cancel the composition string when the IME is deactivated (for example, from a keyboard layout change).
[??????????]IME_PROP_ACCEPT_WIDE_VKEY:輸入法發送Unicode字符數據是用SendInput發送VK_PACKET。MSDN: Windows 2000/XP: If set, the IME processes the injected Unicode that came from the SendInput function by using VK_PACKET. If clear, the IME might not process the injected Unicode, and the injected Unicode might be sent to the application directly.
IGP_CONVERSION:
[0x0000]IME_CMODE_ALPHANUMERIC:英文字母和數字輸入。
[0x0001]IME_CMODE_NATIVE:本地語言輸入。MSDN: Set to 1 if NATIVE mode; 0 if ALPHANUMERIC mode.
[0x0002]IME_CMODE_KATAKANA:[日]片假名。MSDN: Set to 1 if KATAKANA mode; 0 if HIRAGANA mode.
[0x0003]IME_CMODE_LANGUAGE:???。
[0x0008]IME_CMODE_FULLSHAPE:全角/半角。MSDN: Set to 1 if full shape mode; 0 if half shape mode.
[0x0010]IME_CMODE_ROMAN:[日?]羅馬?。MSDN: Set to 1 if ROMAN input mode; 0 if not.
[0x0020]IME_CMODE_CHARCODE:直接輸入字符內碼?MSDN: Set to 1 if character code input mode; 0 if not.
[0x0040]IME_CMODE_HANJACONVERT:[韓]漢字字符模式。MSDN: Set to 1 if HANJA convert mode; 0 if not.
[0x0080]IME_CMODE_SOFTKBD:軟鍵盤。MSDN: Set to 1 if Soft Keyboard mode; 0 if not.
[0x0100]IME_CMODE_NOCONVERSION:不轉換。MSDN: Set to 1 to prevent processing of conversions by IME; 0 if not.
[0x0200]IME_CMODE_EUDC:用戶自定義字符。MSDN: Set to 1 if EUDC conversion mode; 0 if not.
[0x0400]IME_CMODE_SYMBOL:中文標點。MSDN: Set to 1 if SYMBOL conversion mode; 0 if not.
[0x0800]IME_CMODE_FIXED:???MSDN: Windows 98/Me, Windows 2000/XP: Set to 1 if fixed conversion mode; 0 if not.
IGP_SENTENCE:
[0x0000]IME_SMODE_NONE:沒有組句信息。MSDN: No information for sentence.
[0x0001]IME_SMODE_PLAURALCLAUSE:有多個子句信息。MSDN: The IME uses plural clause information to carry out conversion processing.
[0x0002]IME_SMODE_SINGLECONVERT:單字符模式。MSDN: The IME carries out conversion processing in single-character mode.
[0x0004]IME_SMODE_AUTOMATIC:自動模式。MSDN: The IME carries out conversion processing in automatic mode.
[0x0008]IME_SMODE_PHRASEPREDICT:詞語聯想。MSDN: The IME uses phrase information to predict the next character.
[0x0010]IME_SMODE_CONVERSATION:逐鍵提示。MSDN: The IME uses conversation mode. This is useful for chat applications.
IGP_UI:
[0x00000001]UI_CAP_2700:支持0度和270度排版(中文豎行排版)。MSDN: Supports text escapement values of 0 or 2700. For more information, see the lfEscapement member of the LOGFONT structure.
[0x00000002]UI_CAP_ROT90:支持所有90度排版。MSDN: Supports text escapement values of 0, 900, 1800, or 2700. For more information, see lfEscapement.
[0x00000004]UI_CAP_ROTANY:支持任意角度排版。MSDN: Supports any text escapement value. For more information, see lfEscapement.
IGP_SETCOMPSTR:
[0x00000001]SCS_CAP_COMPSTR:能夠調用ImmSetCompositionString設置組字串。MSDN: Can create the composition string by calling the ImmSetCompositionString function with the SCS_SETSTR value.
[0x00000002]SCS_CAP_MAKEREAD:能夠修改輸入串。MSDN: Can create the reading string from corresponding composition string when using the ImmSetCompositionString function with SCS_SETSTR and without setting lpRead.
[0x00000004]SCS_CAP_SETRECONVERTSTRING:能夠使用SCS_SETRECONVERTSTRING常數。MSDN: This IME can support reconversion. Use ImmSetCompositionString to do reconversion.
IGP_SELECT:
[0x00000001]SELECT_CAP_CONVERSION:能夠繼承組字屬性。MSDN: Inherits conversion mode when a new IME is selected.
[0x00000002]SELECT_CAP_SENTENCE:能夠繼承組句屬性。MSDN: Inherits sentence mode when a new IME is selected.
常見輸入法的屬性
~~~~~~~~~~~~~~~~
全拼輸入法 5.0 版:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0010804
CharSet: 134
HKL: E0010804
Desc: 全拼輸入法 5.0 版
File: winpy.ime
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000C0006(786438)
[Enum]IME Property
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 000003A9(937)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
00000020: IME_CMODE_CHARCODE
00000080: IME_CMODE_SOFTKBD
00000100: IME_CMODE_NOCONVERSION
00000200: IME_CMODE_EUDC
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00010002(65538)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000003(3)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
智能ABC輸入法 5.0 版:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0040804
CharSet: 134
HKL: E0040804
Desc: 智能ABC輸入法 5.0 版
File: winabc.ime
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 00040006(262150)
[Enum]IME Property
00040000: IME_PROP_CANDLIST_START_FROM_1
IGP_CONVERSION: 00000189(393)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
00000080: IME_CMODE_SOFTKBD
00000100: IME_CMODE_NOCONVERSION
IGP_SENTENCE: 00000001(1)
[Enum]IME Sentence Mode
00000001: IME_SMODE_PLAURALCLAUSE
IGP_UI: 00010002(65538)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000003(3)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
區位輸入法 5.0 版:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0050804
CharSet: 134
HKL: E0050804
Desc: 區位輸入法 5.0 版
File: wingb.ime
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000C0006(786438)
[Enum]IME Property
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 000001A9(425)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
00000020: IME_CMODE_CHARCODE
00000080: IME_CMODE_SOFTKBD
00000100: IME_CMODE_NOCONVERSION
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00010002(65538)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000003(3)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
王碼五筆型輸入法 86 版:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0100804
CharSet: 134
HKL: E0100804
Desc: 王碼五筆型輸入法 86 版
File: WINWB86.IME
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000C0006(786438)
[Enum]IME Property
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 000003A9(937)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
00000020: IME_CMODE_CHARCODE
00000080: IME_CMODE_SOFTKBD
00000100: IME_CMODE_NOCONVERSION
00000200: IME_CMODE_EUDC
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00010002(65538)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000003(3)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
王碼五筆型輸入法 98 版:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0110804
CharSet: 134
HKL: E0110804
Desc: 王碼五筆型輸入法 98 版
File: WINWB98.IME
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000C0006(786438)
[Enum]IME Property
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 000003A9(937)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
00000020: IME_CMODE_CHARCODE
00000080: IME_CMODE_SOFTKBD
00000100: IME_CMODE_NOCONVERSION
00000200: IME_CMODE_EUDC
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00010002(65538)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000003(3)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
紫光拼音輸入法3.0:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: E0200804
CharSet: 134
HKL: E0200804
Desc: 紫光拼音輸入法3.0
File: UNISPIM.IME
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 00020002(131074)
[Enum]IME Property
00020000: IME_PROP_SPECIAL_UI
IGP_CONVERSION: 00000488(1160)
[Enum]IME Conversion Mode
00000008: IME_CMODE_FULLSHAPE
00000080: IME_CMODE_SOFTKBD
00000400: IME_CMODE_SYMBOL
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00010001(65537)
[Enum]IME User Interface
00000001: UI_CAP_2700
IGP_SETCOMPSTR: 00000000(0)
[Enum]IME set Composition String
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
微軟拼音2003:
hWnd: 000403B6
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000086
lParam: 08040804
CharSet: 134
HKL: 08040804
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000D000A(851978)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 00000009(9)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
IGP_SENTENCE: 00000001(1)
[Enum]IME Sentence Mode
00000001: IME_SMODE_PLAURALCLAUSE
IGP_UI: 00000002(2)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000007(7)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
00000004: SCS_CAP_SETRECONVERTSTRING
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
[臺灣]微軟註音輸入法:
hWnd: 000503AE
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000088
lParam: 04040404
CharSet: 136
HKL: 04040404
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 000D000A(851978)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 00000009(9)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000008: IME_CMODE_FULLSHAPE
IGP_SENTENCE: 00000001(1)
[Enum]IME Sentence Mode
00000001: IME_SMODE_PLAURALCLAUSE
IGP_UI: 00000002(2)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000007(7)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
00000004: SCS_CAP_SETRECONVERTSTRING
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
[日語]Microsoft Natural Input 2002:
hWnd: 000503AE
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000080
lParam: 04110411
CharSet: 128
HKL: 04110411
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 001D000A(1900554)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00040000: IME_PROP_CANDLIST_START_FROM_1
00080000: IME_PROP_UNICODE
00100000: IME_PROP_COMPLETE_ON_UNSELECT
IGP_CONVERSION: 0000000B(11)
[Enum]IME Conversion Mode
00000001: IME_CMODE_NATIVE
00000002: IME_CMODE_KATAKANA
00000003: IME_CMODE_LANGUAGE
00000008: IME_CMODE_FULLSHAPE
IGP_SENTENCE: 00000011(17)
[Enum]IME Sentence Mode
00000001: IME_SMODE_PLAURALCLAUSE
00000010: IME_SMODE_CONVERSATION
IGP_UI: 00000002(2)
[Enum]IME User Interface
00000002: UI_CAP_ROT90
IGP_SETCOMPSTR: 00000007(7)
[Enum]IME set Composition String
00000001: SCS_CAP_COMPSTR
00000002: SCS_CAP_MAKEREAD
00000004: SCS_CAP_SETRECONVERTSTRING
IGP_SELECT: 00000003(3)
[Enum]IME Selection inheritance capabilities
00000001: SELECT_CAP_CONVERSION
00000002: SELECT_CAP_SENTENCE
阿拉伯語:
hWnd: 000503AE
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 000000B2
lParam: F0291401
CharSet: 178
HKL: F0291401
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 00090000(589824)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 00000000(0)
[Enum]IME Conversion Mode
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00000000(0)
[Enum]IME User Interface
IGP_SETCOMPSTR: 00000000(0)
[Enum]IME set Composition String
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
法語(法國):
hWnd: 000503AE
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000000
lParam: 040C040C
CharSet: 0
HKL: 040C040C
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 00090000(589824)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 00000000(0)
[Enum]IME Conversion Mode
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00000000(0)
[Enum]IME User Interface
IGP_SETCOMPSTR: 00000000(0)
[Enum]IME set Composition String
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
英語(英國):
hWnd: 000503AE
uMsg: 00000051{WM_INPUTLANGCHANGE
wParam: 00000000
lParam: 08090809
CharSet: 0
HKL: 08090809
Desc:
File:
IGP_GETIMEVERSION: 00040000(262144)
IGP_PROPERTY: 00090000(589824)
[Enum]IME Property
00010000: IME_PROP_AT_CARET
00080000: IME_PROP_UNICODE
IGP_CONVERSION: 00000000(0)
[Enum]IME Conversion Mode
IGP_SENTENCE: 00000000(0)
[Enum]IME Sentence Mode
IGP_UI: 00000000(0)
[Enum]IME User Interface
IGP_SETCOMPSTR: 00000000(0)
[Enum]IME set Composition String
IGP_SELECT: 00000000(0)
[Enum]IME Selection inheritance capabilities
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.