ImmDev.pas
资源名称:Wingb_Mz.rar [点击查看]
上传用户:wen198501
上传日期:2013-04-01
资源大小:335k
文件大小:37k
源码类别:
输入法编程
开发平台:
Delphi
- {******************************************************}
- { }
- { Copyright (c) 1993-1998 Microsoft Corporation }
- { }
- { Module Name: Immdev.h ->> ImmDev.pas }
- { }
- { Translator: Liu_mazi@126.com, 2005-11-12 }
- { }
- {******************************************************}
- unit ImmDev;
- {$I Define.Inc}
- interface
- uses Windows;
- type
- HImc = DWord;
- HImcc = DWord;
- PHKL = ^HKL;
- type
- PCompositionForm = ^TCompositionForm;
- TCompositionForm = record
- dwStyle: DWord;
- ptCurrentPos: TPoint;
- rcArea: TRect;
- end;
- type
- PCandidateForm = ^TCandidateForm;
- TCandidateForm = record
- dwIndex: DWord;
- dwStyle: DWord;
- ptCurrentPos: TPoint;
- rcArea: TRect;
- end;
- type
- PCandidateList = ^TCandidateList;
- TCandidateList = record
- dwSize: DWord;
- dwStyle: DWord;
- dwCount: DWord;
- dwSelection: DWord;
- dwPageStart: DWord;
- dwPageSize: DWord;
- dwOffset: array[0..0] of DWord;
- end;
- type
- PRegisterWordA = ^TRegisterWordA;
- TRegisterWordA = record
- lpReading: PAnsiChar;
- lpWord: PAnsiChar;
- end;
- PRegisterWordW = ^TRegisterWordW;
- TRegisterWordW = record
- lpReading: PWideChar;
- lpWord: PWideChar;
- end;
- TRegisterWord = TRegisterWordA;
- PRegisterWord = PRegisterWordA;
- type
- PReconvertString = ^TReconvertString;
- TReconvertString = record
- dwSize: DWord;
- dwVersion: DWord;
- dwStrLen: DWord;
- dwStrOffset: DWord;
- dwCompStrLen: DWord;
- dwCompStrOffset: DWord;
- dwTargetStrLen: DWord;
- dwTargetStrOffset: DWord;
- end;
- const
- STYLE_DESCRIPTION_SIZE = 32;
- type
- PStyleBufA = ^TStyleBufA;
- TStyleBufA = record
- dwStyle: DWord;
- szDescription: array[0..STYLE_DESCRIPTION_SIZE-1] of AnsiChar;
- end;
- PStyleBufW = ^TStyleBufW;
- TStyleBufW = record
- dwStyle: DWord;
- szDescription: array[0..STYLE_DESCRIPTION_SIZE-1] of WideChar;
- end;
- TStyleBuf = TStyleBufA;
- PStyleBuf = PStyleBufA;
- const
- IMEMENUITEM_STRING_SIZE = 80;
- type
- PImeMenuItemInfoA = ^TImeMenuItemInfoA;
- TImeMenuItemInfoA = record
- cbSize: UInt;
- fType: UInt;
- fState: UInt;
- wID: UInt;
- hbmpChecked: HBitmap;
- hbmpUnchecked: HBitmap;
- dwItemData: DWord;
- szString: array[0..IMEMENUITEM_STRING_SIZE-1] of AnsiChar;
- hbmpItem: HBitmap;
- end;
- PImeMenuItemInfoW = ^TImeMenuItemInfoW;
- TImeMenuItemInfoW = record
- cbSize: UInt;
- fType: UInt;
- fState: UInt;
- wID: UInt;
- hbmpChecked: HBitmap;
- hbmpUnchecked: HBitmap;
- dwItemData: DWord;
- szString: array[0..IMEMENUITEM_STRING_SIZE-1] of WideChar;
- hbmpItem: HBitmap;
- end;
- TImeMenuItemInfo = TImeMenuItemInfoA;
- PImeMenuItemInfo = PImeMenuItemInfoA;
- type
- PImeCharPosition = ^TImeCharPosition;
- TImeCharPosition = record
- dwSize: DWord;
- dwCharPos: DWord;
- pt: TPoint;
- cLineHeight: UInt;
- rcDocument: TRect;
- end;
- type
- ImcEnumProc = function(hImc: HImc; lParam: LParam): Bool; stdcall;
- // prototype of IMM API ..
- function ImmInstallIME(lpszIMEFileName, lpszLayoutText: PChar): HKL; stdcall;
- function ImmInstallIMEA(lpszIMEFileName, lpszLayoutText: PAnsiChar): HKL; stdcall;
- function ImmInstallIMEW(lpszIMEFileName, lpszLayoutText: PWideChar): HKL; stdcall;
- function ImmGetDefaultIMEWnd(hWnd: HWnd): HWnd; stdcall;
- function ImmGetDescription(hKl: HKL; lpszDescription: PChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetDescriptionA(hKl: HKL; lpszDescription: PAnsiChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetDescriptionW(hKl: HKL; lpszDescription: PWideChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetIMEFileName(hKl: HKL; lpszFileName: PChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetIMEFileNameA(hKl: HKL; lpszFileName: PAnsiChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetIMEFileNameW(hKl: HKL; lpszFileName: PWideChar; uBufLen: UInt): UInt; stdcall;
- function ImmGetProperty(hKl: HKL; fdwIndex: DWord): DWord; stdcall;
- function ImmIsIME(hKl: HKL): Bool; stdcall;
- function ImmSimulateHotKey(hWnd: HWnd; dwHotKeyID: DWord): Bool; stdcall;
- function ImmCreateContext(): HImc; stdcall;
- function ImmDestroyContext(hImc: HImc): Bool; stdcall;
- function ImmGetContext(hWnd: HWnd): HImc; stdcall;
- function ImmReleaseContext(hWnd: HWnd; hImc: HImc): Bool; stdcall;
- function ImmAssociateContext(hWnd: HWnd; hImc: HImc): HImc; stdcall;
- function ImmAssociateContextEx(hWnd: HWnd; hIMC: HImc; dwFlags: DWord): Bool; stdcall;
- function ImmGetCompositionString(hImc: HImc; dwIndex: DWord; lpBuf: Pointer; dwBufLen: DWord): LongInt; stdcall;
- function ImmGetCompositionStringA(hImc: HImc; dwIndex: DWord; lpBuf: Pointer; dwBufLen: DWord): LongInt; stdcall;
- function ImmGetCompositionStringW(hImc: HImc; dwIndex: DWord; lpBuf: Pointer; dwBufLen: DWord): LongInt; stdcall;
- function ImmSetCompositionString(hImc: HImc; dwIndex: DWord; lpComp: Pointer; dwCompLen: DWord; lpRead: Pointer; dwReadLen: DWord): Bool; stdcall;
- function ImmSetCompositionStringA(hImc: HImc; dwIndex: DWord; lpComp: Pointer; dwCompLen: DWord; lpRead: Pointer; dwReadLen: DWord): Bool; stdcall;
- function ImmSetCompositionStringW(hImc: HImc; dwIndex: DWord; lpComp: Pointer; dwCompLen: DWord; lpRead: Pointer; dwReadLen: DWord): Bool; stdcall;
- function ImmGetCandidateListCount(hImc: HImc; lpdwListCount: PDWord): DWord; stdcall;
- function ImmGetCandidateListCountA(hImc: HImc; lpdwListCount: PDWord): DWord; stdcall;
- function ImmGetCandidateListCountW(hImc: HImc; lpdwListCount: PDWord): DWord; stdcall;
- function ImmGetCandidateList(hImc: HImc; deIndex: DWord; lpCandidateList: PCandidateList; dwBufLen: DWord): DWord; stdcall;
- function ImmGetCandidateListA(hImc: HImc; deIndex: DWord; lpCandidateList: PCandidateList; dwBufLen: DWord): DWord; stdcall;
- function ImmGetCandidateListW(hImc: HImc; deIndex: DWord; lpCandidateList: PCandidateList; dwBufLen: DWord): DWord; stdcall;
- function ImmGetGuideLine(hImc: HImc; dwIndex: DWord; lpBuf: PChar; dwBufLen: DWord): DWord; stdcall;
- function ImmGetGuideLineA(hImc: HImc; dwIndex: DWord; lpBuf: PAnsiChar; dwBufLen: DWord): DWord; stdcall;
- function ImmGetGuideLineW(hImc: HImc; dwIndex: DWord; lpBuf: PWideChar; dwBufLen: DWord): DWord; stdcall;
- function ImmGetConversionStatus(hImc: HImc; lpfdwConversion, lpfdwSentence: PDWord): Bool; stdcall;
- function ImmSetConversionStatus(hImc: HImc; fdwConversion, fdwSentence: DWord): Bool; stdcall;
- function ImmGetOpenStatus(hImc: HImc): Bool; stdcall;
- function ImmSetOpenStatus(hImc: HImc; fOpen: Bool): Bool; stdcall;
- function ImmGetCompositionFont(hImc: HImc; lpLogfont: PLogFont): Bool; stdcall;
- function ImmGetCompositionFontA(hImc: HImc; lpLogfont: PLogFontA): Bool; stdcall;
- function ImmGetCompositionFontW(hImc: HImc; lpLogfont: PLogFontW): Bool; stdcall;
- function ImmSetCompositionFont(hImc: HImc; lpLogfont: PLogFont): Bool; stdcall;
- function ImmSetCompositionFontA(hImc: HImc; lpLogfont: PLogFontA): Bool; stdcall;
- function ImmSetCompositionFontW(hImc: HImc; lpLogfont: PLogFontW): Bool; stdcall;
- function ImmConfigureIME(hKl: HKL; hWnd: HWnd; dwMode: DWord; lpData: Pointer): Bool; stdcall;
- function ImmConfigureIMEA(hKl: HKL; hWnd: HWnd; dwMode: DWord; lpData: Pointer): Bool; stdcall;
- function ImmConfigureIMEW(hKl: HKL; hWnd: HWnd; dwMode: DWord; lpData: Pointer): Bool; stdcall;
- function ImmEscape(hKl: HKL; hImc: HImc; uEscape: UInt; lpData: Pointer): LResult; stdcall;
- function ImmEscapeA(hKl: HKL; hImc: HImc; uEscape: UInt; lpData: Pointer): LResult; stdcall;
- function ImmEscapeW(hKl: HKL; hImc: HImc; uEscape: UInt; lpData: Pointer): LResult; stdcall;
- function ImmGetConversionList(hKl: HKL; hImc: HImc; lpSrc: PChar; lpDst: PCandidateList; dwBufLen: DWord; uFlag: UInt): DWord; stdcall;
- function ImmGetConversionListA(hKl: HKL; hImc: HImc; lpSrc: PAnsiChar; lpDst: PCandidateList; dwBufLen: DWord; uFlag: UInt): DWord; stdcall;
- function ImmGetConversionListW(hKl: HKL; hImc: HImc; lpSrc: PWideChar; lpDst: PCandidateList; dwBufLen: DWord; uFlag: UInt): DWord; stdcall;
- function ImmNotifyIME(hImc: HImc; dwAction, dwIndex, dwValue: DWord): Bool; stdcall;
- function ImmGetStatusWindowPos(hImc: HImc; lpptPos: PPoint): Bool; stdcall;
- function ImmSetStatusWindowPos(hImc: HImc; lpptPos: PPoint): Bool; stdcall;
- function ImmGetCompositionWindow(hImc: HImc; lpCompForm: PCompositionForm): Bool; stdcall;
- function ImmSetCompositionWindow(hImc: HImc; lpCompForm: PCompositionForm): Bool; stdcall;
- function ImmGetCandidateWindow(hImc: HImc; dwBufLen: DWord; lpCandidate: PCandidateForm): Bool; stdcall;
- function ImmSetCandidateWindow(hImc: HImc; lpCandidate: PCandidateForm): Bool; stdcall;
- function ImmIsUIMessage(hWnd: HWnd; uMsg: UInt; wParam: WParam; lParam: LParam): Bool; stdcall;
- function ImmIsUIMessageA(hWnd: HWnd; uMsg: UInt; wParam: WParam; lParam: LParam): Bool; stdcall;
- function ImmIsUIMessageW(hWnd: HWnd; uMsg: UInt; wParam: WParam; lParam: LParam): Bool; stdcall;
- function ImmGetVirtualKey(hWnd: HWnd): UInt; stdcall;
- type
- RegisterWordEnumProcA = function(lpszReading: PAnsiChar; dwStyle: DWord; lpszString: PAnsiChar; lpData: Pointer): UInt; stdcall;
- RegisterWordEnumProcW = function(lpszReading: PWideChar; dwStyle: DWord; lpszString: PWideChar; lpData: Pointer): UInt; stdcall;
- RegisterWordEnumProc = RegisterWordEnumProcA;
- function ImmRegisterWord(hKl: HKL; lpszReading: PChar; dwStyle: DWord; lpszRegister: PChar): Bool; stdcall;
- function ImmRegisterWordA(hKl: HKL; lpszReading: PAnsiChar; dwStyle: DWord; lpszRegister: PAnsiChar): Bool; stdcall;
- function ImmRegisterWordW(hKl: HKL; lpszReading: PWideChar; dwStyle: DWord; lpszRegister: PWideChar): Bool; stdcall;
- function ImmUnregisterWord(hKl: HKL; lpszReading: PChar; dwStyle: DWord; lpszUnregister: PChar): Bool; stdcall;
- function ImmUnregisterWordA(hKl: HKL; lpszReading: PAnsiChar; dwStyle: DWord; lpszUnregister: PAnsiChar): Bool; stdcall;
- function ImmUnregisterWordW(hKl: HKL; lpszReading: PWideChar; dwStyle: DWord; lpszUnregister: PWideChar): Bool; stdcall;
- function ImmGetRegisterWordStyle(hKl: HKL; nItem: UInt; lpStyleBuf: PStyleBuf): UInt; stdcall;
- function ImmGetRegisterWordStyleA(hKl: HKL; nItem: UInt; lpStyleBuf: PStyleBufA): UInt; stdcall;
- function ImmGetRegisterWordStyleW(hKl: HKL; nItem: UInt; lpStyleBuf: PStyleBufW): UInt; stdcall;
- function ImmEnumRegisterWord(hKl: HKL; lpfnEnumProc: RegisterWordEnumProc; lpszReading: PChar; dwStyle: DWord; lpszRegister: PChar; lpData: Pointer): UInt; stdcall;
- function ImmEnumRegisterWordA(hKl: HKL; lpfnEnumProc: RegisterWordEnumProcA; lpszReading: PAnsiChar; dwStyle: DWord; lpszRegister: PAnsiChar; lpData: Pointer): UInt; stdcall;
- function ImmEnumRegisterWordW(hKl: HKL; lpfnEnumProc: RegisterWordEnumProcW; lpszReading: PWideChar; dwStyle: DWord; lpszRegister: PWideChar; lpData: Pointer): UInt; stdcall;
- function ImmDisableIME(idThread: DWord): Bool; stdcall;
- function ImmEnumInputContext(idThread: DWord; lpfn: ImcEnumProc; lParam: LParam): Bool; stdcall;
- function ImmGetImeMenuItems(hImc: HImc; dwFlags, dwType: DWord; lpImeParentMenu, lpImeMenu: PImeMenuItemInfo; dwSize: DWord): DWord; stdcall;
- function ImmGetImeMenuItemsA(hImc: HImc; dwFlags, dwType: DWord; lpImeParentMenu, lpImeMenu: PImeMenuItemInfoA; dwSize: DWord): DWord; stdcall;
- function ImmGetImeMenuItemsW(hImc: HImc; dwFlags, dwType: DWord; lpImeParentMenu, lpImeMenu: PImeMenuItemInfoW; dwSize: DWord): DWord; stdcall;
- // wParam for WM_IME_CONTROL
- const
- IMC_GETCANDIDATEPOS = $0007;
- IMC_SETCANDIDATEPOS = $0008;
- IMC_GETCOMPOSITIONFONT = $0009;
- IMC_SETCOMPOSITIONFONT = $000A;
- IMC_GETCOMPOSITIONWINDOW = $000B;
- IMC_SETCOMPOSITIONWINDOW = $000C;
- IMC_GETSTATUSWINDOWPOS = $000F;
- IMC_SETSTATUSWINDOWPOS = $0010;
- IMC_CLOSESTATUSWINDOW = $0021;
- IMC_OPENSTATUSWINDOW = $0022;
- // dwAction for ImmNotifyIME
- const
- NI_OPENCANDIDATE = $0010;
- NI_CLOSECANDIDATE = $0011;
- NI_SELECTCANDIDATESTR = $0012;
- NI_CHANGECANDIDATELIST = $0013;
- NI_FINALIZECONVERSIONRESULT = $0014;
- NI_COMPOSITIONSTR = $0015;
- NI_SETCANDIDATE_PAGESTART = $0016;
- NI_SETCANDIDATE_PAGESIZE = $0017;
- NI_IMEMENUSELECTED = $0018;
- // lParam for WM_IME_SETCONTEXT
- const
- ISC_SHOWUICANDIDATEWINDOW = $00000001;
- ISC_SHOWUICOMPOSITIONWINDOW = $80000000;
- ISC_SHOWUIGUIDELINE = $40000000;
- ISC_SHOWUIALLCANDIDATEWINDOW = $0000000F;
- ISC_SHOWUIALL = $C000000F;
- // dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
- const
- CPS_COMPLETE = $0001;
- CPS_CONVERT = $0002;
- CPS_REVERT = $0003;
- CPS_CANCEL = $0004;
- // the modifiers of hot key
- const
- MOD_ALT = $0001;
- MOD_CONTROL = $0002;
- MOD_SHIFT = $0004;
- MOD_LEFT = $8000;
- MOD_RIGHT = $4000;
- MOD_ON_KEYUP = $0800;
- MOD_IGNORE_ALL_MODIFIER = $0400;
- // Windows for Simplified Chinese Edition hot key ID from 0x10 - 0x2F
- const
- IME_CHOTKEY_IME_NONIME_TOGGLE = $10;
- IME_CHOTKEY_SHAPE_TOGGLE = $11;
- IME_CHOTKEY_SYMBOL_TOGGLE = $12;
- // Windows for Japanese Edition hot key ID from 0x30 - 0x4F
- const
- IME_JHOTKEY_CLOSE_OPEN = $30;
- // Windows for Korean Edition hot key ID from 0x50 - 0x6F
- const
- IME_KHOTKEY_SHAPE_TOGGLE = $50;
- IME_KHOTKEY_HANJACONVERT = $51;
- IME_KHOTKEY_ENGLISH = $52;
- // Windows for Traditional Chinese Edition hot key ID from 0x70 - 0x8F
- const
- IME_THOTKEY_IME_NONIME_TOGGLE = $70;
- IME_THOTKEY_SHAPE_TOGGLE = $71;
- IME_THOTKEY_SYMBOL_TOGGLE = $72;
- // direct switch hot key ID from 0x100 - 0x11F
- const
- IME_HOTKEY_DSWITCH_FIRST = $100;
- IME_HOTKEY_DSWITCH_LAST = $11F;
- // IME private hot key from 0x200 - 0x21F
- const
- IME_HOTKEY_PRIVATE_FIRST = $200;
- IME_ITHOTKEY_RESEND_RESULTSTR = $200;
- IME_ITHOTKEY_PREVIOUS_COMPOSITION = $201;
- IME_ITHOTKEY_UISTYLE_TOGGLE = $202;
- IME_ITHOTKEY_RECONVERTSTRING = $203;
- IME_HOTKEY_PRIVATE_LAST = $21F;
- // parameter of ImmGetCompositionString
- const
- GCS_COMPREADSTR = $0001;
- GCS_COMPREADATTR = $0002;
- GCS_COMPREADCLAUSE = $0004;
- GCS_COMPSTR = $0008;
- GCS_COMPATTR = $0010;
- GCS_COMPCLAUSE = $0020;
- GCS_CURSORPOS = $0080;
- GCS_DELTASTART = $0100;
- GCS_RESULTREADSTR = $0200;
- GCS_RESULTREADCLAUSE = $0400;
- GCS_RESULTSTR = $0800;
- GCS_RESULTCLAUSE = $1000;
- // style bit flags for WM_IME_COMPOSITION
- const
- CS_INSERTCHAR = $2000;
- CS_NOMOVECARET = $4000;
- // IME version constants
- const
- IMEVER_0310 = $0003000A;
- IMEVER_0400 = $00040000;
- // IME property bits
- const
- IME_PROP_AT_CARET = $00010000;
- IME_PROP_SPECIAL_UI = $00020000;
- IME_PROP_CANDLIST_START_FROM_1= $00040000;
- IME_PROP_UNICODE = $00080000;
- IME_PROP_COMPLETE_ON_UNSELECT = $00100000;
- // IME UICapability bits
- const
- UI_CAP_2700 = $00000001;
- UI_CAP_ROT90 = $00000002;
- UI_CAP_ROTANY = $00000004;
- // ImmSetCompositionString Capability bits
- const
- SCS_CAP_COMPSTR = $00000001;
- SCS_CAP_MAKEREAD = $00000002;
- SCS_CAP_SETRECONVERTSTRING = $00000004;
- // IME WM_IME_SELECT inheritance Capability bits
- const
- SELECT_CAP_CONVERSION = $00000001;
- SELECT_CAP_SENTENCE = $00000002;
- // ID for deIndex of ImmGetGuideLine
- const
- GGL_LEVEL = $00000001;
- GGL_INDEX = $00000002;
- GGL_STRING = $00000003;
- GGL_PRIVATE = $00000004;
- // ID for dwLevel of GUIDELINE Structure
- const
- GL_LEVEL_NOGUIDELINE = $00000000;
- GL_LEVEL_FATAL = $00000001;
- GL_LEVEL_ERROR = $00000002;
- GL_LEVEL_WARNING = $00000003;
- GL_LEVEL_INFORMATION = $00000004;
- // ID for dwIndex of GUIDELINE Structure
- const
- GL_ID_UNKNOWN = $00000000;
- GL_ID_NOMODULE = $00000001;
- GL_ID_NODICTIONARY = $00000010;
- GL_ID_CANNOTSAVE = $00000011;
- GL_ID_NOCONVERT = $00000020;
- GL_ID_TYPINGERROR = $00000021;
- GL_ID_TOOMANYSTROKE = $00000022;
- GL_ID_READINGCONFLICT = $00000023;
- GL_ID_INPUTREADING = $00000024;
- GL_ID_INPUTRADICAL = $00000025;
- GL_ID_INPUTCODE = $00000026;
- GL_ID_INPUTSYMBOL = $00000027;
- GL_ID_CHOOSECANDIDATE = $00000028;
- GL_ID_REVERSECONVERSION = $00000029;
- GL_ID_PRIVATE_FIRST = $00008000;
- GL_ID_PRIVATE_LAST = $0000FFFF;
- // ID for dwIndex of ImmGetProperty
- const
- IGP_GETIMEVERSION = DWORD(-4);
- IGP_PROPERTY = $00000004;
- IGP_CONVERSION = $00000008;
- IGP_SENTENCE = $0000000c;
- IGP_UI = $00000010;
- IGP_SETCOMPSTR = $00000014;
- IGP_SELECT = $00000018;
- // dwIndex for ImmSetCompositionString API
- const
- SCS_SETSTR = GCS_COMPREADSTR or GCS_COMPSTR;
- SCS_CHANGEATTR = GCS_COMPREADATTR or GCS_COMPATTR;
- SCS_CHANGECLAUSE = GCS_COMPREADCLAUSE or GCS_COMPCLAUSE;
- SCS_SETRECONVERTSTRING = $00010000;
- SCS_QUERYRECONVERTSTRING = $00020000;
- // attribute for COMPOSITIONSTRING Structure
- const
- ATTR_INPUT = $00;
- ATTR_TARGET_CONVERTED = $01;
- ATTR_CONVERTED = $02;
- ATTR_TARGET_NOTCONVERTED = $03;
- ATTR_INPUT_ERROR = $04;
- ATTR_FIXEDCONVERTED = $05;
- // bit field for IMC_SETCOMPOSITIONWINDOW, IMC_SETCANDIDATEWINDOW
- const
- CFS_DEFAULT = $0000;
- CFS_RECT = $0001;
- CFS_POINT = $0002;
- CFS_FORCE_POSITION = $0020;
- CFS_CANDIDATEPOS = $0040;
- CFS_EXCLUDE = $0080;
- // conversion direction for ImmGetConversionList
- const
- GCL_CONVERSION = $0001;
- GCL_REVERSECONVERSION = $0002;
- GCL_REVERSE_LENGTH = $0003;
- // bit field for conversion mode
- const
- IME_CMODE_ALPHANUMERIC = $0000;
- IME_CMODE_NATIVE = $0001;
- IME_CMODE_CHINESE = IME_CMODE_NATIVE;
- IME_CMODE_HANGEUL = IME_CMODE_NATIVE;
- IME_CMODE_HANGUL = IME_CMODE_NATIVE;
- IME_CMODE_JAPANESE = IME_CMODE_NATIVE;
- IME_CMODE_KATAKANA = $0002; // only effect under IME_CMODE_NATIVE
- IME_CMODE_LANGUAGE = $0003;
- IME_CMODE_FULLSHAPE = $0008;
- IME_CMODE_ROMAN = $0010;
- IME_CMODE_CHARCODE = $0020;
- IME_CMODE_HANJACONVERT = $0040;
- IME_CMODE_SOFTKBD = $0080;
- IME_CMODE_NOCONVERSION = $0100;
- IME_CMODE_EUDC = $0200;
- IME_CMODE_SYMBOL = $0400;
- IME_CMODE_FIXED = $0800;
- // bit field for sentence mode
- const
- IME_SMODE_NONE = $0000;
- IME_SMODE_PLAURALCLAUSE = $0001;
- IME_SMODE_SINGLECONVERT = $0002;
- IME_SMODE_AUTOMATIC = $0004;
- IME_SMODE_PHRASEPREDICT = $0008;
- IME_SMODE_CONVERSATION = $0010;
- // style of candidate
- const
- IME_CAND_UNKNOWN = $0000;
- IME_CAND_READ = $0001;
- IME_CAND_CODE = $0002;
- IME_CAND_MEANING = $0003;
- IME_CAND_RADICAL = $0004;
- IME_CAND_STROKE = $0005;
- // wParam of report message WM_IME_NOTIFY
- const
- IMN_CLOSESTATUSWINDOW = $0001;
- IMN_OPENSTATUSWINDOW = $0002;
- IMN_CHANGECANDIDATE = $0003;
- IMN_CLOSECANDIDATE = $0004;
- IMN_OPENCANDIDATE = $0005;
- IMN_SETCONVERSIONMODE = $0006;
- IMN_SETSENTENCEMODE = $0007;
- IMN_SETOPENSTATUS = $0008;
- IMN_SETCANDIDATEPOS = $0009;
- IMN_SETCOMPOSITIONFONT = $000A;
- IMN_SETCOMPOSITIONWINDOW = $000B;
- IMN_SETSTATUSWINDOWPOS = $000C;
- IMN_GUIDELINE = $000D;
- IMN_PRIVATE = $000E;
- // wParam of report message WM_IME_REQUEST
- const
- IMR_COMPOSITIONWINDOW = $0001;
- IMR_CANDIDATEWINDOW = $0002;
- IMR_COMPOSITIONFONT = $0003;
- IMR_RECONVERTSTRING = $0004;
- IMR_CONFIRMRECONVERTSTRING = $0005;
- IMR_QUERYCHARPOSITION = $0006;
- IMR_DOCUMENTFEED = $0007;
- // error code of ImmGetCompositionString
- const
- IMM_ERROR_NODATA = -1;
- IMM_ERROR_GENERAL = -2;
- // dialog mode of ImmConfigureIME
- const
- IME_CONFIG_GENERAL = 1;
- IME_CONFIG_REGISTERWORD = 2;
- IME_CONFIG_SELECTDICTIONARY = 3;
- // flags for ImmEscape
- const
- IME_ESC_QUERY_SUPPORT = $0003;
- IME_ESC_RESERVED_FIRST = $0004;
- IME_ESC_RESERVED_LAST = $07FF;
- IME_ESC_PRIVATE_FIRST = $0800;
- IME_ESC_PRIVATE_LAST = $0FFF;
- IME_ESC_SEQUENCE_TO_INTERNAL = $1001;
- IME_ESC_GET_EUDC_DICTIONARY = $1003;
- IME_ESC_SET_EUDC_DICTIONARY = $1004;
- IME_ESC_MAX_KEY = $1005;
- IME_ESC_IME_NAME = $1006;
- IME_ESC_SYNC_HOTKEY = $1007;
- IME_ESC_HANJA_MODE = $1008;
- IME_ESC_AUTOMATA = $1009;
- IME_ESC_PRIVATE_HOTKEY = $100a;
- IME_ESC_GETHELPFILENAME = $100b;
- // style of word registration
- const
- IME_REGWORD_STYLE_EUDC = $00000001;
- IME_REGWORD_STYLE_USER_FIRST = $80000000;
- IME_REGWORD_STYLE_USER_LAST = $FFFFFFFF;
- // dwFlags for ImmAssociateContextEx
- const
- IACE_CHILDREN = $0001;
- IACE_DEFAULT = $0010;
- IACE_IGNORENOCONTEXT = $0020;
- // dwFlags for ImmGetImeMenuItems
- const
- IGIMIF_RIGHTMENU = $0001;
- // dwType for ImmGetImeMenuItems
- const
- IGIMII_CMODE = $0001;
- IGIMII_SMODE = $0002;
- IGIMII_CONFIGURE = $0004;
- IGIMII_TOOLS = $0008;
- IGIMII_HELP = $0010;
- IGIMII_OTHER = $0020;
- IGIMII_INPUTTOOLS = $0040;
- // fType of IMEMENUITEMINFO structure
- const
- IMFT_RADIOCHECK = $00001;
- IMFT_SEPARATOR = $00002;
- IMFT_SUBMENU = $00004;
- // fState of IMEMENUITEMINFO structure
- const
- IMFS_GRAYED = MFS_GRAYED;
- IMFS_DISABLED = MFS_DISABLED;
- IMFS_CHECKED = MFS_CHECKED;
- IMFS_HILITE = MFS_HILITE;
- IMFS_ENABLED = MFS_ENABLED;
- IMFS_UNCHECKED = MFS_UNCHECKED;
- IMFS_UNHILITE = MFS_UNHILITE;
- IMFS_DEFAULT = MFS_DEFAULT;
- // type of soft keyboard
- const
- SOFTKEYBOARD_TYPE_T1 = $0001; // for Windows Tranditional Chinese Edition
- SOFTKEYBOARD_TYPE_C1 = $0002; // for Windows Simplified Chinese Edition
- type
- PCompositionString = ^TCompositionString;
- TCompositionString = record
- dwSize: DWord;
- dwCompReadAttrLen: DWord;
- dwCompReadAttrOffset: DWord;
- dwCompReadClauseLen: DWord;
- dwCompReadClauseOffset: DWord;
- dwCompReadStrLen: DWord;
- dwCompReadStrOffset: DWord;
- dwCompAttrLen: DWord;
- dwCompAttrOffset: DWord;
- dwCompClauseLen: DWord;
- dwCompClauseOffset: DWord;
- dwCompStrLen: DWord;
- dwCompStrOffset: DWord;
- dwCursorPos: DWord;
- dwDeltaStart: DWord;
- dwResultReadClauseLen: DWord;
- dwResultReadClauseOffset: DWord;
- dwResultReadStrLen: DWord;
- dwResultReadStrOffset: DWord;
- dwResultClauseLen: DWord;
- dwResultClauseOffset: DWord;
- dwResultStrLen: DWord;
- dwResultStrOffset: DWord;
- dwPrivateSize: DWord;
- dwPrivateOffset: DWord;
- end;
- type
- PGuideLine = ^TGuideLine;
- TGuideLine = record
- dwSize: DWord;
- dwLevel: DWord;
- dwIndex: DWord;
- dwStrLen: DWord;
- dwStrOffset: DWord;
- dwPrivateSize: DWord;
- dwPrivateOffset: DWord;
- end;
- type
- PTransMsg = ^TTransMsg;
- TTransMsg = record
- message: uInt;
- wParam: WParam;
- lParam: LParam;
- end;
- PTransMsgList = ^TTransMsgList;
- TTransMsgList = record
- uMsgCount: uInt;
- TransMsg: array[0..0] of TTransMsg;
- end;
- type
- PCandidateInfo = ^TCandidateInfo;
- TCandidateInfo = record
- dwSize: DWord;
- dwCount: DWord;
- dwOffset: array[0..31] of DWord;
- dwPrivateSize: DWord;
- dwPrivateOffset: DWord;
- end;
- type
- PInputContext = ^TInputContext;
- TInputContext = record
- hWnd: HWnd;
- fOpen: Bool;
- ptStatusWndPos: TPoint;
- ptSoftKbdPos: TPoint;
- fdwConversion: DWord;
- fdwSentence: DWord;
- lfFont: record
- case Integer of
- 0: (A: TLogFontA);
- 1: (W: TLogFontW);
- end;
- cfCompForm: TCompositionForm;
- cfCandForm: array[0..3] of TCandidateForm;
- hCompStr: HImcc;
- hCandInfo: HImcc;
- hGuideLine: HImcc;
- hPrivate: HImcc;
- dwNumMsgBuf: DWord;
- hMsgBuf: HImcc;
- fdwInit: DWord;
- dwReserve: array[0..2] of DWord;
- end;
- type
- PImeInfo = ^TImeInfo;
- TImeInfo = record
- dwPrivateDataSize: DWord;
- fdwProperty: DWord;
- fdwConversionCaps: DWord;
- fdwSentenceCaps: DWord;
- fdwUICaps: DWord;
- fdwSCSCaps: DWord;
- fdwSelectCaps: DWord;
- end;
- type
- PSoftKbdData = ^TSoftKbdData;
- TSoftKbdData = record
- uCount: UInt;
- wCode: array[0..0, 0..255] of Word;
- end;
- function ImmGetHotKey(dwHotKeyID: DWord; lpuModifiers, lpuVKey: PUInt; lphKL: PHKL): Bool; stdcall;
- function ImmSetHotKey(dwHotKeyID: DWord; uModifiers, uVKey: UInt; hKL: HKL): Bool; stdcall;
- function ImmGenerateMessage(hIMC: HImc): Bool; stdcall;
- function ImmRequestMessage(hImc: HImc; wParam: WParam; lParam: LParam): LResult; stdcall;
- function ImmRequestMessageA(hImc: HImc; wParam: WParam; lParam: LParam): LResult; stdcall;
- function ImmRequestMessageW(hImc: HImc; wParam: WParam; lParam: LParam): LResult; stdcall;
- // Prototype of soft keyboard APIs ..
- function ImmCreateSoftKeyboard(uType: UInt; hOwner: HWnd; x, y: Integer): HWnd; stdcall;
- function ImmDestroySoftKeyboard(hSoftKbdWnd: HWnd): Bool; stdcall;
- function ImmShowSoftKeyboard(hSoftKbdWnd: HWnd; nCmdShow: Integer): Bool; stdcall;
- function ImmLockIMC(hIMC: HImc): PInputContext; stdcall;
- function ImmUnlockIMC(hIMC: HImc): Bool; stdcall;
- function ImmGetIMCLockCount(hIMC: HImc): DWord; stdcall;
- function ImmCreateIMCC(dwSize: DWord): HImcc; stdcall;
- function ImmDestroyIMCC(hIMCC: HImcc): HImcc; stdcall;
- function ImmLockIMCC(hIMCC: HImcc): Pointer; stdcall;
- function ImmUnlockIMCC(hIMCC: HImcc): Bool; stdcall;
- function ImmGetIMCCLockCount(hImcc: HImcc): DWord; stdcall;
- function ImmReSizeIMCC(hIMCC: HImcc; dwSize: DWord): HImcc; stdcall;
- function ImmGetIMCCSize(hIMCC: HImcc): DWord; stdcall;
- // the window extra offset
- const
- IMMGWL_IMC = 0;
- IMMGWL_PRIVATE = SizeOf(Cardinal);
- IMMGWLP_IMC = 0;
- IMMGWLP_PRIVATE = SizeOf(Cardinal);
- // for NI_CONTEXTUPDATED
- const
- IMC_SETCONVERSIONMODE = $0002;
- IMC_SETSENTENCEMODE = $0004;
- IMC_SETOPENSTATUS = $0006;
- // wParam for WM_IME_CONTROL to the soft keyboard
- const
- IMC_GETSOFTKBDFONT = $0011;
- IMC_SETSOFTKBDFONT = $0012;
- IMC_GETSOFTKBDPOS = $0013;
- IMC_SETSOFTKBDPOS = $0014;
- IMC_GETSOFTKBDSUBTYPE = $0015;
- IMC_SETSOFTKBDSUBTYPE = $0016;
- IMC_SETSOFTKBDDATA = $0018;
- // dwAction for ImmNotifyIME
- const
- NI_CONTEXTUPDATED = $0003;
- // dwSystemInfoFlags bits
- const
- IME_SYSINFO_WINLOGON = $0001;
- IME_SYSINFO_WOW16 = $0002;
- // parameter of ImmGetCompositionString, **
- const
- GCS_COMP = GCS_COMPSTR or GCS_COMPATTR or GCS_COMPCLAUSE;
- GCS_COMPREAD = GCS_COMPREADSTR or GCS_COMPREADATTR or GCS_COMPREADCLAUSE;
- GCS_RESULT = GCS_RESULTSTR or GCS_RESULTCLAUSE;
- GCS_RESULTREAD = GCS_RESULTREADSTR or GCS_RESULTREADCLAUSE;
- // bits of fdwInit of INPUTCONTEXT
- const
- INIT_STATUSWNDPOS = $00000001;
- INIT_CONVERSION = $00000002;
- INIT_SENTENCE = $00000004;
- INIT_LOGFONT = $00000008;
- INIT_COMPFORM = $00000010;
- INIT_SOFTKBDPOS = $00000020;
- // IME property bits
- const
- IME_PROP_END_UNLOAD = $00000001;
- IME_PROP_KBD_CHAR_FIRST = $00000002;
- IME_PROP_IGNORE_UPKEYS = $00000004;
- IME_PROP_NEED_ALTKEY = $00000008;
- IME_PROP_NO_KEYS_ON_CLOSE = $00000010;
- IME_PROP_ACCEPT_WIDE_VKEY = $00000020;
- // IME UICapability bits
- const
- UI_CAP_SOFTKBD = $00010000;
- const
- IMN_SOFTKBDDESTROYED = $0011;
- // flags for ImmEscape
- const
- IME_ESC_PENAUXDATA = $100c;
- // Pen Input support
- type
- PImePenData = ^TImePenData;
- TImePenData = record
- dwVersion: DWord;
- dwFlags: DWord;
- dwCount: DWord;
- lpExtraInfo: Pointer;
- ulReserve: uLong;
- wd: record
- lpSymbol: PDWord;
- lpSkip: PWord;
- lpScore: PWord;
- end;
- end;
- const
- IME_PEN_SYMBOL = $00000010;
- IME_PEN_SKIP = $00000020;
- IME_PEN_SCORE = $00000040;
- implementation
- const Imm32 = 'Imm32.dll';
- function ImmInstallIME; external Imm32 name 'ImmInstallIMEA';
- function ImmInstallIMEA; external Imm32 name 'ImmInstallIMEA';
- function ImmInstallIMEW; external Imm32 name 'ImmInstallIMEW';
- function ImmGetDefaultIMEWnd; external Imm32 name 'ImmGetDefaultIMEWnd';
- function ImmGetDescription; external Imm32 name 'ImmGetDescriptionA';
- function ImmGetDescriptionA; external Imm32 name 'ImmGetDescriptionA';
- function ImmGetDescriptionW; external Imm32 name 'ImmGetDescriptionW';
- function ImmGetIMEFileName; external Imm32 name 'ImmGetIMEFileNameA';
- function ImmGetIMEFileNameA; external Imm32 name 'ImmGetIMEFileNameA';
- function ImmGetIMEFileNameW; external Imm32 name 'ImmGetIMEFileNameW';
- function ImmGetProperty; external Imm32 name 'ImmGetProperty';
- function ImmIsIME; external Imm32 name 'ImmIsIME';
- function ImmSimulateHotKey; external Imm32 name 'ImmSimulateHotKey';
- function ImmCreateContext; external Imm32 name 'ImmCreateContext';
- function ImmDestroyContext; external Imm32 name 'ImmDestroyContext';
- function ImmGetContext; external Imm32 name 'ImmGetContext';
- function ImmReleaseContext; external Imm32 name 'ImmReleaseContext';
- function ImmAssociateContext; external Imm32 name 'ImmAssociateContext';
- function ImmAssociateContextEx; external Imm32 name 'ImmAssociateContextEx';
- function ImmGetCompositionString; external Imm32 name 'ImmGetCompositionStringA';
- function ImmGetCompositionStringA; external Imm32 name 'ImmGetCompositionStringA';
- function ImmGetCompositionStringW; external Imm32 name 'ImmGetCompositionStringW';
- function ImmSetCompositionString; external Imm32 name 'ImmSetCompositionStringA';
- function ImmSetCompositionStringA; external Imm32 name 'ImmSetCompositionStringA';
- function ImmSetCompositionStringW; external Imm32 name 'ImmSetCompositionStringW';
- function ImmGetCandidateListCount; external Imm32 name 'ImmGetCandidateListCountA';
- function ImmGetCandidateListCountA; external Imm32 name 'ImmGetCandidateListCountA';
- function ImmGetCandidateListCountW; external Imm32 name 'ImmGetCandidateListCountW';
- function ImmGetCandidateList; external Imm32 name 'ImmGetCandidateListA';
- function ImmGetCandidateListA; external Imm32 name 'ImmGetCandidateListA';
- function ImmGetCandidateListW; external Imm32 name 'ImmGetCandidateListW';
- function ImmGetGuideLine; external Imm32 name 'ImmGetGuideLineA';
- function ImmGetGuideLineA; external Imm32 name 'ImmGetGuideLineA';
- function ImmGetGuideLineW; external Imm32 name 'ImmGetGuideLineW';
- function ImmGetConversionStatus; external Imm32 name 'ImmGetConversionStatus';
- function ImmSetConversionStatus; external Imm32 name 'ImmSetConversionStatus';
- function ImmGetOpenStatus; external Imm32 name 'ImmGetOpenStatus';
- function ImmSetOpenStatus; external Imm32 name 'ImmSetOpenStatus';
- function ImmGetCompositionFont; external Imm32 name 'ImmGetCompositionFontA';
- function ImmGetCompositionFontA; external Imm32 name 'ImmGetCompositionFontA';
- function ImmGetCompositionFontW; external Imm32 name 'ImmGetCompositionFontW';
- function ImmSetCompositionFont; external Imm32 name 'ImmSetCompositionFontA';
- function ImmSetCompositionFontA; external Imm32 name 'ImmSetCompositionFontA';
- function ImmSetCompositionFontW; external Imm32 name 'ImmSetCompositionFontW';
- function ImmConfigureIME; external Imm32 name 'ImmConfigureIMEA';
- function ImmConfigureIMEA; external Imm32 name 'ImmConfigureIMEA';
- function ImmConfigureIMEW; external Imm32 name 'ImmConfigureIMEW';
- function ImmEscape; external Imm32 name 'ImmEscapeA';
- function ImmEscapeA; external Imm32 name 'ImmEscapeA';
- function ImmEscapeW; external Imm32 name 'ImmEscapeW';
- function ImmGetConversionList; external Imm32 name 'ImmGetConversionListA';
- function ImmGetConversionListA; external Imm32 name 'ImmGetConversionListA';
- function ImmGetConversionListW; external Imm32 name 'ImmGetConversionListW';
- function ImmNotifyIME; external Imm32 name 'ImmNotifyIME';
- function ImmGetStatusWindowPos; external Imm32 name 'ImmGetStatusWindowPos';
- function ImmSetStatusWindowPos; external Imm32 name 'ImmSetStatusWindowPos';
- function ImmGetCompositionWindow; external Imm32 name 'ImmGetCompositionWindow';
- function ImmSetCompositionWindow; external Imm32 name 'ImmSetCompositionWindow';
- function ImmGetCandidateWindow; external Imm32 name 'ImmGetCandidateWindow';
- function ImmSetCandidateWindow; external Imm32 name 'ImmSetCandidateWindow';
- function ImmIsUIMessage; external Imm32 name 'ImmIsUIMessageA';
- function ImmIsUIMessageA; external Imm32 name 'ImmIsUIMessageA';
- function ImmIsUIMessageW; external Imm32 name 'ImmIsUIMessageW';
- function ImmGetVirtualKey; external Imm32 name 'ImmGetVirtualKey';
- function ImmRegisterWord; external Imm32 name 'ImmRegisterWordA';
- function ImmRegisterWordA; external Imm32 name 'ImmRegisterWordA';
- function ImmRegisterWordW; external Imm32 name 'ImmRegisterWordW';
- function ImmUnregisterWord; external Imm32 name 'ImmUnregisterWordA';
- function ImmUnregisterWordA; external Imm32 name 'ImmUnregisterWordA';
- function ImmUnregisterWordW; external Imm32 name 'ImmUnregisterWordW';
- function ImmGetRegisterWordStyle; external Imm32 name 'ImmGetRegisterWordStyleA';
- function ImmGetRegisterWordStyleA; external Imm32 name 'ImmGetRegisterWordStyleA';
- function ImmGetRegisterWordStyleW; external Imm32 name 'ImmGetRegisterWordStyleW';
- function ImmEnumRegisterWord; external Imm32 name 'ImmEnumRegisterWordA';
- function ImmEnumRegisterWordA; external Imm32 name 'ImmEnumRegisterWordA';
- function ImmEnumRegisterWordW; external Imm32 name 'ImmEnumRegisterWordW';
- function ImmDisableIME; external Imm32 name 'ImmDisableIME';
- function ImmEnumInputContext; external Imm32 name 'ImmEnumInputContext';
- function ImmGetImeMenuItems; external Imm32 name 'ImmGetImeMenuItemsA';
- function ImmGetImeMenuItemsA; external Imm32 name 'ImmGetImeMenuItemsA';
- function ImmGetImeMenuItemsW; external Imm32 name 'ImmGetImeMenuItemsW';
- function ImmGetHotKey; external Imm32 name 'ImmGetHotKey';
- function ImmSetHotKey; external Imm32 name 'ImmSetHotKey';
- function ImmGenerateMessage; external Imm32 name 'ImmGenerateMessage';
- function ImmRequestMessage; external Imm32 name 'ImmRequestMessageA';
- function ImmRequestMessageA; external Imm32 name 'ImmRequestMessageA';
- function ImmRequestMessageW; external Imm32 name 'ImmRequestMessageW';
- function ImmCreateSoftKeyboard; external Imm32 name 'ImmCreateSoftKeyboard';
- function ImmDestroySoftKeyboard; external Imm32 name 'ImmDestroySoftKeyboard';
- function ImmShowSoftKeyboard; external Imm32 name 'ImmShowSoftKeyboard';
- function ImmLockIMC; external Imm32 name 'ImmLockIMC';
- function ImmUnlockIMC; external Imm32 name 'ImmUnlockIMC';
- function ImmGetIMCLockCount; external Imm32 name 'ImmGetIMCLockCount';
- function ImmCreateIMCC; external Imm32 name 'ImmCreateIMCC';
- function ImmDestroyIMCC; external Imm32 name 'ImmDestroyIMCC';
- function ImmLockIMCC; external Imm32 name 'ImmLockIMCC';
- function ImmUnlockIMCC; external Imm32 name 'ImmUnlockIMCC';
- function ImmGetIMCCLockCount; external Imm32 name 'ImmGetIMCCLockCount';
- function ImmReSizeIMCC; external Imm32 name 'ImmReSizeIMCC';
- function ImmGetIMCCSize; external Imm32 name 'ImmGetIMCCSize';
- end.