Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

415 lines
13 KiB

  1. /**********************************************************************/
  2. /* IME31.H - 3.1 Input Method related definitions */
  3. /* */
  4. /* Copyright (c) 1993-1994 Microsoft Corporation */
  5. /**********************************************************************/
  6. #ifndef _INC_IME31
  7. #define _INC_IME31 // defined if IME31.H has been included
  8. typedef struct _tagDATETIME {
  9. WORD year;
  10. WORD month;
  11. WORD day;
  12. WORD hour;
  13. WORD min;
  14. WORD sec;
  15. } DATETIME;
  16. // compatible IMEPro - this is the same as 3.1 in 3 countries
  17. typedef struct _tagCIMEPRO {
  18. HWND hWnd;
  19. DATETIME InstDate;
  20. UINT wVersion;
  21. BYTE szDescription[50];
  22. BYTE szName[80];
  23. BYTE szOptions[30];
  24. #ifdef TAIWAN
  25. BYTE szUsrFontName[80];
  26. BOOL fEnable;
  27. #endif
  28. } CIMEPRO;
  29. typedef CIMEPRO *PCIMEPRO;
  30. typedef CIMEPRO NEAR *NPCIMEPRO;
  31. typedef CIMEPRO FAR *LPCIMEPRO;
  32. // new IMEPro - this is the same in 3 countries
  33. typedef struct _tagNIMEPRO {
  34. HWND hWnd;
  35. DATETIME InstDate;
  36. UINT wVersion;
  37. BYTE szDescription[50];
  38. BYTE szName[80];
  39. BYTE szOptions[30];
  40. } NIMEPRO;
  41. typedef NIMEPRO *PNIMEPRO;
  42. typedef NIMEPRO NEAR *NPNIMEPRO;
  43. typedef NIMEPRO FAR *LPNIMEPRO;
  44. // wParam for WINNLSSendString
  45. #define WSST_STRING 0
  46. #define WSST_STRINGEX 1
  47. #ifdef _INC_IMMSTRUC
  48. BOOL WINAPI WINNLSInquire(LPIMELINK, LPTHREADLINK, LPPTHREADLINK);
  49. #endif
  50. BOOL WINAPI IMPGetIME(HWND, LPCIMEPRO);
  51. BOOL WINAPI IMPQueryIME(LPCIMEPRO);
  52. BOOL WINAPI IMPAddIME(LPNIMEPRO);
  53. BOOL WINAPI IMPDeleteIME(LPNIMEPRO);
  54. BOOL WINAPI IMPSetIME(HWND, LPNIMEPRO);
  55. BOOL WINAPI IMPModifyIME(LPSTR, LPCIMEPRO);
  56. WORD WINAPI IMPGetDefaultIME(LPNIMEPRO);
  57. WORD WINAPI IMPSetDefaultIME(LPNIMEPRO);
  58. BOOL WINAPI WINNLSSetIMEHandle(LPSTR, HWND);
  59. BOOL WINAPI WINNLSSetIMEStatus(HWND, BOOL);
  60. BOOL WINAPI WINNLSEnableIME(HWND, BOOL);
  61. UINT WINAPI WINNLSGetKeyState(void);
  62. BOOL WINAPI WINNLSSetKeyState(UINT);
  63. BOOL WINAPI WINNLSGetEnableStatus(HWND);
  64. BOOL WINAPI WINNLSSetKeyboardHook(BOOL);
  65. BOOL WINAPI WINNLSSendControl(WORD, WORD);
  66. BOOL WINAPI WINNLSSendString(HWND, WORD, LPVOID);
  67. BOOL WINAPI WINNLSPostAppMessage(HWND, UINT, WPARAM, LPARAM);
  68. LRESULT WINAPI WINNLSSendAppMessage(HWND, UINT, WPARAM, LPARAM);
  69. #if defined(JAPAN)
  70. BOOL WINAPI WINNLSSetIMEHotkey(HWND, UINT);
  71. UINT WINAPI WINNLSGetIMEHotkey(HWND);
  72. #endif
  73. // 4.0 APIs
  74. int WINAPI WINNLSTranslateMessage(int, LPDWORD, HIMC);
  75. UINT WINAPI WINNLSGet31ModeFrom40CMode(DWORD);
  76. DWORD WINAPI WINNLSGet40CModeFrom31Mode(UINT);
  77. #ifdef _INC_IMMSTRUC
  78. BOOL WINAPI IMPInstallIME(LPIMELINK);
  79. BOOL WINAPI IMPUpdateIMESettings(LPIMELINK, int);
  80. BOOL WINAPI IMPDeleteIMESettings(LPIMELINK, int);
  81. #endif
  82. #if defined(CHINA) || defined(JAPAN) || defined(TAIWAN)
  83. // dispatch IME support functions
  84. BOOL WINAPI WINNLSSetDispatchDDIs(HINSTANCE);
  85. BOOL WINAPI WINNLSClearDispatchDDIs(HINSTANCE);
  86. BOOL WINAPI IMPDispatchGetIME(HINSTANCE, LPCIMEPRO);
  87. #endif
  88. #if defined(CHINA) || defined(TAIWAN)
  89. // Chinese Windows WINNLS functions
  90. BOOL WINAPI IMPSetFirstIME(HWND, LPNIMEPRO);
  91. BOOL WINAPI IMPGetFirstIME(HWND, LPCIMEPRO);
  92. BOOL WINAPI WINNLSDefIMEProc(HWND, HDC, WPARAM, WPARAM, LPARAM, LPARAM);
  93. LRESULT WINAPI ControlIMEMessage(HWND, LPCIMEPRO, WPARAM, WPARAM, LPARAM);
  94. BOOL WINAPI IMPRetrieveIME(LPCIMEPRO, WPARAM);
  95. // Chinese Windows 3.0 WINNLS APIs, these APIs just return fail in 4.0
  96. BOOL WINAPI IMPEnableIME(HWND, LPCIMEPRO, BOOL);
  97. BOOL WINAPI IMPSetUsrFont(HWND, LPCIMEPRO);
  98. BOOL WINAPI WINNLSQueryIMEInfo(HWND, HWND, LPVOID);
  99. BOOL WINAPI InquireIME(void);
  100. #endif
  101. typedef struct tagIMESTRUCT {
  102. UINT fnc; // function code
  103. WPARAM wParam; // word parameter
  104. UINT wCount; // word counter
  105. UINT dchSource; // offset to Source from top of memory object
  106. UINT dchDest; // offset to Desrination from top of memory object
  107. LPARAM lParam1;
  108. LPARAM lParam2;
  109. LPARAM lParam3;
  110. } IMESTRUCT;
  111. typedef IMESTRUCT *PIMESTRUCT;
  112. typedef IMESTRUCT NEAR *NPIMESTRUCT;
  113. typedef IMESTRUCT FAR *LPIMESTRUCT;
  114. typedef struct tagOLDUNDETERMINESTRUCT {
  115. UINT uSize;
  116. UINT uDefIMESize;
  117. UINT uLength;
  118. UINT uDeltaStart;
  119. UINT uCursorPos;
  120. BYTE cbColor[16];
  121. // -- below members will have variable length. --
  122. // BYTE cbAttrib[];
  123. // BYTE cbText[];
  124. // BYTE cbIMEDef[];
  125. } OLDUNDETERMINESTRUCT;
  126. typedef OLDUNDETERMINESTRUCT *POLDUNDETERMINESTRUCT;
  127. typedef OLDUNDETERMINESTRUCT NEAR *NPOLDUNDETERMINESTRUCT;
  128. typedef OLDUNDETERMINESTRUCT FAR *LPOLDUNDETERMINESTRUCT;
  129. typedef struct tagUNDETERMINESTRUCT {
  130. DWORD dwSize;
  131. UINT uDefIMESize;
  132. UINT uDefIMEPos;
  133. UINT uUndetTextLen;
  134. UINT uUndetTextPos;
  135. UINT uUndetAttrPos;
  136. UINT uCursorPos;
  137. UINT uDeltaStart;
  138. UINT uDetermineTextLen;
  139. UINT uDetermineTextPos;
  140. UINT uDetermineDelimPos;
  141. UINT uYomiTextLen;
  142. UINT uYomiTextPos;
  143. UINT uYomiDelimPos;
  144. } UNDETERMINESTRUCT;
  145. typedef UNDETERMINESTRUCT *PUNDETERMINESTRUCT;
  146. typedef UNDETERMINESTRUCT NEAR *NPUNDETERMINESTRUCT;
  147. typedef UNDETERMINESTRUCT FAR *LPUNDETERMINESTRUCT;
  148. typedef struct tagSTRINGEXSTRUCT {
  149. DWORD dwSize;
  150. UINT uDeterminePos;
  151. UINT uDetermineDelimPos;
  152. UINT uYomiPos;
  153. UINT uYomiDelimPos;
  154. } STRINGEXSTRUCT;
  155. typedef STRINGEXSTRUCT *PSTRINGEXSTRUCT;
  156. typedef STRINGEXSTRUCT NEAR *NPSTRINGEXSTRUCT;
  157. typedef STRINGEXSTRUCT FAR *LPSTRINGEXSTRUCT;
  158. #ifdef KOREA
  159. #define CP_HWND 0
  160. #define CP_OPEN 1
  161. #define CP_DIRECT 2
  162. #define CP_LEVEL 3
  163. #define lpSource(lpks) (LPSTR)((LPSTR)lpks+lpks->dchSource)
  164. #define lpDest(lpks) (LPSTR)((LPSTR)lpks+lpks->dchDest)
  165. #endif // KOREA
  166. #ifdef JAPAN
  167. // virtual key of Japan
  168. #define VK_DBE_ALPHANUMERIC 0x0f0
  169. #define VK_DBE_KATAKANA 0x0f1
  170. #define VK_DBE_HIRAGANA 0x0f2
  171. #define VK_DBE_SBCSCHAR 0x0f3
  172. #define VK_DBE_DBCSCHAR 0x0f4
  173. #define VK_DBE_ROMAN 0x0f5
  174. #define VK_DBE_NOROMAN 0x0f6
  175. #define VK_DBE_ENTERIMECONFIGMODE 0x0f8
  176. #define VK_DBE_FLUSHSTRING 0x0f9
  177. #define VK_DBE_CODEINPUT 0x0fa
  178. #define VK_DBE_NOCODEINPUT 0x0fb
  179. #define VK_DBE_DETERMINESTRING 0x0fc
  180. #define VK_DBE_ENTERDLGCONVERSIONMODE 0x0fd
  181. #endif // JAPAN
  182. #ifdef KOREA
  183. // virtual key of Korea
  184. #define VK_FINAL 0x18
  185. #define VK_CONVERT 0x1C
  186. #define VK_NONCONVERT 0x1D
  187. #define VK_ACCEPT 0x1E
  188. #define VK_MODECHANGE 0x1F
  189. #endif
  190. // IME subfunctions
  191. #define IME_GETIMECAPS 0x03
  192. #define IME_SETOPEN 0x04
  193. #define IME_GETOPEN 0x05
  194. #define IME_ENABLEDOSIME 0x06
  195. #define IME_GETVERSION 0x07
  196. #define IME_SETCONVERSIONWINDOW 0x08
  197. #define IME_SETCONVERSIONMODE 0x10
  198. #define IME_GETCONVERSIONMODE 0x11
  199. #define IME_SETCONVERSIONFONT 0x12
  200. #define IME_SENDVKEY 0x13
  201. #define IME_DESTROYIME 0x14
  202. #define IME_PRIVATE 0x15
  203. #define IME_WINDOWUPDATE 0x16
  204. #define IME_SELECT 0x17
  205. #define IME_ENTERWORDREGISTERMODE 0x18
  206. #define IME_SETCONVERSIONFONTEX 0x19
  207. #define IME_DBCSNAME 0x1A
  208. #define IME_MAXKEY 0x1B
  209. #define IME_CODECONVERT 0x20
  210. #define IME_SETUSRFONT 0x20
  211. #define IME_CONVERTLIST 0x21
  212. #define IME_QUERYUSRFONT 0x21
  213. #define IME_INPUTKEYTOSEQUENCE 0x22
  214. #define IME_SEQUENCETOINTERNAL 0x23
  215. #define IME_QUERYIMEINFO 0x24
  216. #define IME_DIALOG 0x25
  217. #define IME_AUTOMATA 0x30
  218. #define IME_HANJAMODE 0x31
  219. #define IME_GETLEVEL 0x40
  220. #define IME_SETLEVEL 0x41
  221. #define IME_GETMNTABLE 0x42
  222. #define IME_SETUNDETERMINESTRING 0x50
  223. #define IME_SETCAPTURE 0x51
  224. #define IME_PRIVATEFIRST 0x0100
  225. #define IME_PRIVATELAST 0x04FF
  226. // 3.0 IME subfunctions
  227. #define IME_QUERY IME_GETIMECAPS
  228. #define IME_ENABLE IME_ENABLEDOSIME
  229. #define IME_GET_MODE IME_GETCONVERSIONMODE
  230. #define IME_SETFONT IME_SETCONVERSIONFONT
  231. #define IME_SENDKEY IME_SENDVKEY
  232. #define IME_DESTROY IME_DESTROYIME
  233. #define IME_WORDREGISTER IME_ENTERWORDREGISTERMODE
  234. #ifdef KOREA
  235. #define IME_MOVEIMEWINDOW IME_SETCONVERSIONWINDOW
  236. #define IME_SET_MODE 0x12
  237. #else
  238. #define IME_MOVECONVERTWINDOW IME_SETCONVERSIONWINDOW
  239. #define IME_SET_MODE IME_SETCONVERSIONMODE
  240. #endif
  241. #if defined(JAPAN) || defined(KOREA)
  242. #define MCW_DEFAULT 0x00
  243. #define MCW_RECT 0x01
  244. #define MCW_WINDOW 0x02
  245. #define MCW_SCREEN 0x04
  246. #define MCW_VERTICAL 0x08
  247. #define MCW_HIDDEN 0x10
  248. #define MCW_CMD 0x16
  249. #endif
  250. #ifdef KOREA
  251. // IME_CODECONVERT subfunctions
  252. #define IME_BANJAtoJUNJA 0x13
  253. #define IME_JUNJAtoBANJA 0x14
  254. #define IME_JOHABtoKS 0x15
  255. #define IME_KStoJOHAB 0x16
  256. // IME_AUTOMATA subfunctions
  257. #define IMEA_INIT 0x01
  258. #define IMEA_NEXT 0x02
  259. #define IMEA_PREV 0x03
  260. // IME_HANJAMODE subfunctions
  261. #define IME_REQUEST_CONVERT 0x01
  262. #define IME_ENABLE_CONVERT 0x02
  263. // IME_MOVEIMEWINDOW subfunctions
  264. #define INTERIM_WINDOW 0x00
  265. #define MODE_WINDOW 0x01
  266. #define HANJA_WINDOW 0x02
  267. #endif // KOREA
  268. #if defined(CHINA) || defined(TAIWAN)
  269. #define SK_KEY_MAX 46
  270. #define IMEPROC_SWITCH 0x0001
  271. // the IMEPROC_SK is from 0x0010 ~ 0x001F
  272. #define IMEPROC_SK 0x0010
  273. #define IMEPROC_SK0 0x0010
  274. #define IMEPROC_SK1 0x0011
  275. #define IMEPROC_SK2 0x0012
  276. #define PROC_INFO 0x0001
  277. #define PROC_SHOW 0x0002
  278. #define PROC_HIDE 0x0004
  279. #define BY_IME_HWND 0x0000
  280. #define BY_IME_NAME 0x0001
  281. #define BY_IME_DESCRIPTION 0x0002
  282. #define BY_IME_DEFAULT 0x000F
  283. // Those bits are used by ControlIMEMessage()
  284. // 0x0030 - the two bits are for post/send messages control
  285. // CTRL_NONE - don't send and post
  286. #define CTRL_MSG_MASK 0x0030
  287. #define CTRL_SEND 0x0000
  288. #define CTRL_POST 0x0010
  289. #define CTRL_NONE 0x0030
  290. #define CTRL_USER_ALLOC 0x0040
  291. // CTRL_MODIFY_??? - modify imepro of specified IME
  292. // CTRL_MODIFY is all modify bits, but now only one bit
  293. #define CTRL_MODIFY_USR_DIC 0x0080
  294. #define CTRL_MODIFY CTRL_MODIFY_USR_DIC
  295. #endif // CHINA || TAIWAN
  296. // conversion mode
  297. #define IME_MODE_ALPHANUMERIC 0x0001
  298. #define IME_MODE_KATAKANA 0x0002
  299. #define IME_MODE_HIRAGANA 0x0004
  300. #define IME_MODE_HANJACONVERT 0x0004
  301. #define IME_MODE_DBCSCHAR 0x0010
  302. #define IME_MODE_ROMAN 0x0020
  303. #define IME_MODE_NOROMAN 0x0040
  304. #define IME_MODE_CODEINPUT 0x0080
  305. #define IME_MODE_NOCODEINPUT 0x0100
  306. #define IME_MODE_LHS 0x0200
  307. #define IME_MODE_NOLHS 0x0400
  308. #define IME_MODE_SK 0x0800
  309. #define IME_MODE_NOSK 0x1000
  310. #define IME_MODE_XSPACE 0x2000
  311. #define IME_MODE_NOXSPACE 0x4000
  312. #ifdef KOREA
  313. #define IME_MODE_SBCSCHAR 0x0002
  314. #else
  315. #define IME_MODE_SBCSCHAR 0x0008
  316. #endif
  317. // error code
  318. #define IME_RS_ERROR 0x01 // general error
  319. #define IME_RS_NOIME 0x02 // IME is not installed
  320. #define IME_RS_TOOLONG 0x05 // given string is too long
  321. #define IME_RS_ILLEGAL 0x06 // illegal charactor(s) is string
  322. #define IME_RS_NOTFOUND 0x07 // no (more) candidate
  323. #define IME_RS_NOROOM 0x0a // no disk/memory space
  324. #define IME_RS_DISKERROR 0x0e // disk I/O error
  325. #define IME_RS_CAPTURED 0x10 // IME is captured (PENWIN)
  326. #define IME_RS_INVALID 0x11 // invalid sub-function was specified
  327. #define IME_RS_NEST 0x12 // called nested
  328. #define IME_RS_SYSTEMMODAL 0x13 // called when system mode
  329. #define WM_IME_REPORT 0x0280
  330. #define WM_IMEKEYDOWN 0x0290
  331. #define WM_IMEKEYUP 0x0291
  332. // wParam of report message WM_IME_REPORT
  333. #define IR_STRINGSTART 0x0100
  334. #define IR_STRINGEND 0x0101
  335. #define IR_OPENCONVERT 0x0120
  336. #define IR_CHANGECONVERT 0x0121
  337. #define IR_CLOSECONVERT 0x0122
  338. #define IR_FULLCONVERT 0x0123
  339. #define IR_IMESELECT 0x0130
  340. #define IR_STRING 0x0140
  341. #define IR_DBCSCHAR 0x0160
  342. #define IR_UNDETERMINE 0x0170
  343. #define IR_STRINGEX 0x0180
  344. // return value for IME_VERSION
  345. #define IMEVER_31 0x0a03
  346. WORD WINAPI SendIMEMessage(HWND, LPARAM);
  347. LRESULT WINAPI SendIMEMessageEx(HWND, LPARAM);
  348. #if defined(CHINA) || defined(TAIWAN)
  349. LRESULT WINAPI ControlIMEMessage(HWND, LPCIMEPRO, WPARAM, WPARAM, LPARAM);
  350. #endif
  351. #endif // _INC_IME31