' api_imm.sbp

Type _System_DeclareHandle_HIMC:unused As DWord:End Type
TypeDef HIMC = *_System_DeclareHandle_HIMC
Type _System_DeclareHandle_HIMCC:unused As DWord:End Type
TypeDef HIMCC = *_System_DeclareHandle_HIMCC

Type COMPOSITIONFORM
	dwStyle As DWord
	ptCurrentPos As POINTAPI
	rcArea As RECT
End Type
TypeDef PCOMPOSITIONFORM = *COMPOSITIONFORM
TypeDef NPCOMPOSITIONFORM = *COMPOSITIONFORM
TypeDef LPCOMPOSITIONFORM = *COMPOSITIONFORM

Type CANDIDATEFORM
	dwIndex As DWord
	dwStyle As DWord
	ptCurrentPos As POINTAPI
	rcArea As RECT
End Type
TypeDef PCANDIDATEFORM = *CANDIDATEFORM
TypeDef NPCANDIDATEFORM = *CANDIDATEFORM
TypeDef LPCANDIDATEFORM = *CANDIDATEFORM

Type CANDIDATELIST
dwSize As DWord
dwStyle As DWord
dwCount As DWord
dwSelection As DWord
dwPageStart As DWord
dwPageSize As DWord
dwOffset[ELM(1)] As DWord
End Type
TypeDef PCANDIDATELIST = *CANDIDATELIST
TypeDef NPCANDIDATELIST = *CANDIDATELIST
TypeDef LPCANDIDATELIST = *CANDIDATELIST

Type REGISTERWORDA
	lpReading As LPSTR
	lpWord As LPSTR
End Type
TypeDef PREGISTERWORDA = *REGISTERWORDA
TypeDef NPREGISTERWORDA = *REGISTERWORDA
TypeDef LPREGISTERWORDA = *REGISTERWORDA

Type REGISTERWORDW
	lpReading As LPWSTR
	lpWord As LPWSTR
End Type
TypeDef PREGISTERWORDW = *REGISTERWORDW
TypeDef NPREGISTERWORDW = *REGISTERWORDW
TypeDef LPREGISTERWORDW = *REGISTERWORDW

#ifdef UNICODE
TypeDef REGISTERWORD = REGISTERWORDW
TypeDef PREGISTERWORD = PREGISTERWORDW
TypeDef NPREGISTERWORD = NPREGISTERWORDW
TypeDef LPREGISTERWORD = LPREGISTERWORDW
#else
TypeDef REGISTERWORD = REGISTERWORDA
TypeDef PREGISTERWORD = PREGISTERWORDA
TypeDef NPREGISTERWORD = NPREGISTERWORDA
TypeDef LPREGISTERWORD = LPREGISTERWORDA
#endif

Type RECONVERTSTRING
	dwSize As DWord
	dwVersion As DWord
	dwStrLen As DWord
	dwStrOffset As DWord
	dwCompStrLen As DWord
	dwCompStrOffset As DWord
	dwTargetStrLen As DWord
	dwTargetStrOffset As DWord
End Type
TypeDef PRECONVERTSTRING = *RECONVERTSTRING
TypeDef NPRECONVERTSTRING = *RECONVERTSTRING
TypeDef LPRECONVERTSTRING = *RECONVERTSTRING

Const STYLE_DESCRIPTION_SIZE = 32

Type STYLEBUFA
	dwStyle As DWord
	szDescription[ELM(STYLE_DESCRIPTION_SIZE)] As CHAR
End Type
TypeDef PSTYLEBUFA = *STYLEBUFA
TypeDef NPSTYLEBUFA = *STYLEBUFA
TypeDef LPSTYLEBUFA = *STYLEBUFA

Type STYLEBUFW
	dwStyle As DWord
	szDescription[ELM(STYLE_DESCRIPTION_SIZE)] As WCHAR
End Type
TypeDef PSTYLEBUFW = *STYLEBUFW
TypeDef NPSTYLEBUFW = *STYLEBUFW
TypeDef LPSTYLEBUFW = *STYLEBUFW

#ifdef UNICODE
TypeDef STYLEBUF = STYLEBUFW
TypeDef PSTYLEBUF = PSTYLEBUFW
TypeDef NPSTYLEBUF = NPSTYLEBUFW
TypeDef LPSTYLEBUF = LPSTYLEBUFW
#else
TypeDef STYLEBUF = STYLEBUFA
TypeDef PSTYLEBUF = PSTYLEBUFA
TypeDef NPSTYLEBUF = NPSTYLEBUFA
TypeDef LPSTYLEBUF = LPSTYLEBUFA
#endif

Const IMEMENUITEM_STRING_SIZE = 80

Type IMEMENUITEMINFOA
	cbSize As DWord
	fType As DWord
	fState As DWord
	wID As DWord
	hbmpChecked As HBITMAP
	hbmpUnchecked As HBITMAP
	dwItemData As DWord
	szString[ELM(IMEMENUITEM_STRING_SIZE)] As CHAR
	hbmpItem As HBITMAP
End Type
TypeDef PIMEMENUITEMINFOA = *IMEMENUITEMINFOA
TypeDef NPIMEMENUITEMINFOA = *IMEMENUITEMINFOA
TypeDef LPIMEMENUITEMINFOA = *IMEMENUITEMINFOA

Type IMEMENUITEMINFOW
	cbSize As DWord
	fType As DWord
	fState As DWord
	wID As DWord
	hbmpChecked As HBITMAP
	hbmpUnchecked As HBITMAP
	dwItemData As DWord
	szString[ELM(IMEMENUITEM_STRING_SIZE)] As WCHAR
	hbmpItem As HBITMAP
End Type
TypeDef PIMEMENUITEMINFOW = *IMEMENUITEMINFOW
TypeDef NPIMEMENUITEMINFOW = *IMEMENUITEMINFOW
TypeDef LPIMEMENUITEMINFOW = *IMEMENUITEMINFOW

#ifdef UNICODE
TypeDef IMEMENUITEMINFO = IMEMENUITEMINFOW
TypeDef PIMEMENUITEMINFO = PIMEMENUITEMINFOW
TypeDef NPIMEMENUITEMINFO = NPIMEMENUITEMINFOW
TypeDef LPIMEMENUITEMINFO = LPIMEMENUITEMINFOW
#else
TypeDef IMEMENUITEMINFO = IMEMENUITEMINFOA
TypeDef PIMEMENUITEMINFO = PIMEMENUITEMINFOA
TypeDef NPIMEMENUITEMINFO = NPIMEMENUITEMINFOA
TypeDef LPIMEMENUITEMINFO = LPIMEMENUITEMINFOA
#endif

Type IMECHARPOSITION
	dwSize As DWord
	dwCharPos As DWord
	pt As POINTAPI
	cLineHeight As DWord
	rcDocument As RECT
End Type
TypeDef PIMECHARPOSITION = *IMECHARPOSITION
TypeDef NPIMECHARPOSITION = *IMECHARPOSITION
TypeDef LPIMECHARPOSITION = *IMECHARPOSITION

TypeDef IMCENUMPROC = *Function(himc As HIMC, lp As LPARAM) As BOOL

'prototype of IMM API

Declare Function ImmInstallIMEA Lib "imm32" (lpszIMEFileName As LPCSTR, lpszLayoutText As LPCSTR) As HKL
Declare Function ImmInstallIMEW Lib "imm32" (lpszIMEFileName As LPCWSTR, lpszLayoutText As LPCWSTR) As HKL
#ifdef UNICODE
Declare Function ImmInstallIME Lib "imm32" Alias "ImmInstallIMEW" (lpszIMEFileName As LPCWSTR, lpszLayoutText As LPCWSTR) As HKL
#else
Declare Function ImmInstallIME Lib "imm32" Alias "ImmInstallIMEA" (lpszIMEFileName As LPCSTR, lpszLayoutText As LPCSTR) As HKL
#endif

Declare Function ImmGetDefaultIMEWnd Lib "imm32" (hwnd As HWND) As HWND

Declare Function ImmGetDescriptionA Lib "imm32" (hkl As HKL, lpszDescription As LPSTR, uBufLen As DWord) As DWord
Declare Function ImmGetDescriptionW Lib "imm32" (hkl As HKL, lpszDescription As LPWSTR, uBufLen As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetDescription Lib "imm32" Alias "ImmGetDescriptionW" (hkl As HKL, lpszDescription As LPWSTR, uBufLen As DWord) As DWord
#else
Declare Function ImmGetDescription Lib "imm32" Alias "ImmGetDescriptionA" (hkl As HKL, lpszDescription As LPSTR, uBufLen As DWord) As DWord
#endif

Declare Function ImmGetIMEFileNameA Lib "imm32" (lpszFileName As LPSTR, uBufLen As DWord) As DWord
Declare Function ImmGetIMEFileNameW Lib "imm32" (lpszFileName As LPWSTR, uBufLen As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetIMEFileName Lib "imm32" Alias "ImmGetIMEFileNameW" (lpszFileName As LPWSTR, uBufLen As DWord) As DWord
#else
Declare Function ImmGetIMEFileName Lib "imm32" Alias "ImmGetIMEFileNameA" (lpszFileName As LPSTR, uBufLen As DWord) As DWord
#endif

Declare Function ImmGetProperty Lib "imm32" (hkl As HKL, fdwIndex As DWord) As DWord
Declare Function ImmIsIME Lib "imm32" (hkl As HKL) As BOOL
Declare Function ImmSimulateHotKey Lib "imm32" (hwnd As HWND, dwHotKeyID As DWord) As BOOL
Declare Function ImmCreateContext Lib "imm32" () As HIMC
Declare Function ImmDestroyContext Lib "imm32" (himc As HIMC) As BOOL
Declare Function ImmGetContext Lib "imm32" (hwnd As HWND) As HIMC
Declare Function ImmReleaseContext Lib "imm32" (hwnd As HWND, himc As HIMC) As BOOL
Declare Function ImmAssociateContext Lib "imm32" (hwnd As HWND, himc As HIMC) As HIMC
Declare Function ImmAssociateContextEx Lib "imm32" (hwnd As HWND, himc As HIMC, dwFlags As DWord) As HIMC

Declare Function ImmGetCompositionStringA Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
Declare Function ImmGetCompositionStringW Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
#ifdef UNICODE
Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringW" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
#else
Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringA" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
#endif

Declare Function ImmSetCompositionStringA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
Declare Function ImmSetCompositionStringW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
#ifdef UNICODE
Declare Function ImmSetCompositionString Lib "imm32" Alias "ImmSetCompositionStringW" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
#else
Declare Function ImmSetCompositionString Lib "imm32" Alias "ImmSetCompositionStringA" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
#endif

Declare Function ImmGetCandidateListCountA Lib "imm32" (himc As HIMC, ByRef dwListCount As DWord) As DWord
Declare Function ImmGetCandidateListCountW Lib "imm32" (himc As HIMC, ByRef dwListCount As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetCandidateListCount Lib "imm32" Alias "ImmGetCandidateListCountW" (himc As HIMC, ByRef dwListCount As DWord) As DWord
#else
Declare Function ImmGetCandidateListCount Lib "imm32" Alias "ImmGetCandidateListCountA" (himc As HIMC, ByRef dwListCount As DWord) As DWord
#endif

Declare Function ImmGetCandidateListA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
Declare Function ImmGetCandidateListW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetCandidateList Lib "imm32" Alias "ImmGetCandidateListW" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
#else
Declare Function ImmGetCandidateList Lib "imm32" Alias "ImmGetCandidateListA" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
#endif

Declare Function ImmGetGuideLineA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpBuf As LPSTR, dwBufLen As DWord) As DWord
Declare Function ImmGetGuideLineW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpBuf As LPWSTR, dwBufLen As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetGuideLine Lib "imm32"  Alias "ImmGetGuideLineW" (himc As HIMC, dwIndex As DWord, lpBuf As LPWSTR, dwBufLen As DWord) As DWord
#else
Declare Function ImmGetGuideLine Lib "imm32"  Alias "ImmGetGuideLineA" (himc As HIMC, dwIndex As DWord, lpBuf As LPSTR, dwBufLen As DWord) As DWord
#endif

Declare Function ImmGetConversionStatus Lib "imm32" (himc As HIMC, ByRef fdwConversion As DWord, ByRef fdwSentence As DWord) As BOOL
Declare Function ImmSetConversionStatus Lib "imm32" (himc As HIMC, fdwConversion As DWord, fdwSentence As DWord) As BOOL
Declare Function ImmGetOpenStatus Lib "imm32" (himc As HIMC) As BOOL
Declare Function ImmSetOpenStatus Lib "imm32" (himc As HIMC, fOpen As BOOL) As BOOL

#ifndef NOGDI
Declare Function ImmGetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTA) As BOOL
Declare Function ImmGetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTW) As BOOL
#ifdef UNICODE
Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmGetCompositionFontW" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
#else
Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmGetCompositionFontA" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
#endif

Declare Function ImmSetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTA) As Long
Declare Function ImmSetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTW) As Long
#ifdef UNICODE
Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontW" (hIMC As HIMC, ByRef lf As LOGFONT) As Long
#else
Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontA" (hIMC As HIMC, ByRef lf As LOGFONT) As Long
#endif
#endif 'NOGDI

Declare Function ImmConfigureIMEA Lib "imm32" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
Declare Function ImmConfigureIMEW Lib "imm32" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
#ifdef UNICODE
Declare Function ImmConfigureIME Lib "imm32" Alias "ImmConfigureIMEW" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
#else
Declare Function ImmConfigureIME Lib "imm32" Alias "ImmConfigureIMEA" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
#endif

Declare Function ImmEscapeA Lib "imm32" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
Declare Function ImmEscapeW Lib "imm32" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
#ifdef UNICODE
Declare Function ImmEscape Lib "imm32" Alias "ImmEscapeW" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
#else
Declare Function ImmEscape Lib "imm32" Alias "ImmEscapeA" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
#endif

Declare Function ImmGetConversionListA Lib "imm32" (hkl As HKL, lpSrc As LPCSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
Declare Function ImmGetConversionListW Lib "imm32" (hkl As HKL, lpSrc As LPCWSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetConversionList Lib "imm32" Alias "ImmGetConversionListW" (hkl As HKL, lpSrc As LPCWSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
#else
Declare Function ImmGetConversionList Lib "imm32" Alias "ImmGetConversionListA" (hkl As HKL, lpSrc As LPCSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
#endif

Declare Function ImmNotifyIME Lib "imm32" (himc As HIMC, dwAction As DWord, dwIndex As DWord, dwValue As DWord) As BOOL

Declare Function ImmGetStatusWindowPos Lib "imm32" (himc As HIMC, ByRef ptPos As POINTAPI) As BOOL
Declare Function ImmSetStatusWindowPos Lib "imm32" (himc As HIMC, ByRef ptPos As POINTAPI) As BOOL
Declare Function ImmGetCompositionWindow Lib "imm32" (himc As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
Declare Function ImmSetCompositionWindow Lib "imm32" (himc As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
Declare Function ImmGetCandidateWindow Lib "imm32" (himc As HIMC, ByRef Candidate As CANDIDATEFORM) As BOOL
Declare Function ImmSetCandidateWindow Lib "imm32" (himc As HIMC, ByRef Candidate As CANDIDATEFORM) As BOOL

Declare Function ImmIsUIMessageA Lib "imm32" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
Declare Function ImmIsUIMessageW Lib "imm32" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
#ifdef UNICODE
Declare Function ImmIsUIMessage Lib "imm32" Alias "ImmIsUIMessageW" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
#else
Declare Function ImmIsUIMessage Lib "imm32" Alias "ImmIsUIMessageA" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
#endif

TypeDef REGISTERWORDENUMPROCA = *Function(lpszReading As LPCSTR, dwStyle As DWord, lpszString As LPCSTR, lpData As VoidPtr) As Long
TypeDef REGISTERWORDENUMPROCW = *Function(lpszReading As LPCWSTR, dwStyle As DWord, lpszString As LPCWSTR, lpData As VoidPtr) As Long
#ifdef UNICODE
TypeDef REGISTERWORDENUMPROC = REGISTERWORDENUMPROCW
#else
TypeDef REGISTERWORDENUMPROC = REGISTERWORDENUMPROCA
#endif

Declare Function ImmRegisterWordA Lib "imm32" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR) As BOOL
Declare Function ImmRegisterWordW Lib "imm32" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR) As BOOL
#ifdef UNICODE
Declare Function ImmRegisterWord Lib "imm32" Alias "ImmRegisterWordW" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR) As BOOL
#else
Declare Function ImmRegisterWord Lib "imm32" Alias "ImmRegisterWordA" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR) As BOOL
#endif

Declare Function ImmUnregisterWordA Lib "imm32" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszUnregister As LPCSTR) As BOOL
Declare Function ImmUnregisterWordW Lib "imm32" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszUnregister As LPCWSTR) As BOOL
#ifdef UNICODE
Declare Function ImmUnregisterWord Lib "imm32" Alias "ImmUnregisterWordW" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszUnregister As LPCWSTR) As BOOL
#else
Declare Function ImmUnregisterWord Lib "imm32" Alias "ImmUnregisterWordA" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszUnregister As LPCSTR) As BOOL
#endif

Declare Function ImmGetRegisterWordStyleA Lib "imm32" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFA) As DWord
Declare Function ImmGetRegisterWordStyleW Lib "imm32" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFW) As DWord
#ifdef UNICODE
Declare Function ImmGetRegisterWordStyle Lib "imm32" Alias "ImmGetRegisterWordStyleW" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFW) As DWord
#else
Declare Function ImmGetRegisterWordStyle Lib "imm32" Alias "ImmGetRegisterWordStyleA" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFA) As DWord
#endif

Declare Function ImmEnumRegisterWordA Lib "imm32" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCA, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR, lpData As VoidPtr) As DWord
Declare Function ImmEnumRegisterWordW Lib "imm32" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCW, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR, lpData As VoidPtr) As DWord
#ifdef UNICODE
Declare Function ImmEnumRegisterWord Lib "imm32" Alias "ImmEnumRegisterWordW" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCW, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR, lpData As VoidPtr) As DWord
#else
Declare Function ImmEnumRegisterWord Lib "imm32" Alias "ImmEnumRegisterWordA" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCA, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR, lpData As VoidPtr) As DWord
#endif

Declare Function ImmDisableIME Lib "imm32" (idThread As DWord) As BOOL
Declare Function ImmEnumInputContext Lib "imm32" (idThread As DWord, lpfn As IMCENUMPROC, lParam As LPARAM) As BOOL
Declare Function ImmGetImeMenuItemsA Lib "imm32" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOA, lpImeMenu As LPIMEMENUITEMINFOA, dwSoze As DWord) As DWord
Declare Function ImmGetImeMenuItemsW Lib "imm32" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOW, lpImeMenu As LPIMEMENUITEMINFOW, dwSoze As DWord) As DWord
#ifdef UNICODE
Declare Function ImmGetImeMenuItems Lib "imm32" Alias "ImmGetImeMenuItemsW" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOW, lpImeMenu As LPIMEMENUITEMINFOW, dwSoze As DWord) As DWord
#else
Declare Function ImmGetImeMenuItems Lib "imm32" Alias "ImmGetImeMenuItemsA" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOA, lpImeMenu As LPIMEMENUITEMINFOA, dwSoze As DWord) As DWord
#endif
Declare Function ImmDisableTextFrameService Lib "imm32" (idThread As DWord) As BOOL

' wParam for WM_IME_CONTROL
Const IMC_GETCANDIDATEPOS = &h0007
Const IMC_SETCANDIDATEPOS = &h0008
Const IMC_GETCOMPOSITIONFONT = &h0009
Const IMC_SETCOMPOSITIONFONT = &h000A
Const IMC_GETCOMPOSITIONWINDOW = &h000B
Const IMC_SETCOMPOSITIONWINDOW = &h000C
Const IMC_GETSTATUSWINDOWPOS = &h000F
Const IMC_SETSTATUSWINDOWPOS = &h0010
Const IMC_CLOSESTATUSWINDOW = &h0021
Const IMC_OPENSTATUSWINDOW = &h0022


' dwAction for ImmNotifyIME
Const NI_OPENCANDIDATE = &h0010
Const NI_CLOSECANDIDATE = &h0011
Const NI_SELECTCANDIDATESTR = &h0012
Const NI_CHANGECANDIDATELIST = &h0013
Const NI_FINALIZECONVERSIONRESULT = &h0014
Const NI_COMPOSITIONSTR = &h0015
Const NI_SETCANDIDATE_PAGESTART = &h0016
Const NI_SETCANDIDATE_PAGESIZE = &h0017
Const NI_IMEMENUSELECTED = &h0018

' lParam for WM_IME_SETCONTEXT
Const ISC_SHOWUICANDIDATEWINDOW = &h00000001
Const ISC_SHOWUICOMPOSITIONWINDOW = &h80000000
Const ISC_SHOWUIGUIDELINE = &h40000000
Const ISC_SHOWUIALLCANDIDATEWINDOW = &h0000000F
Const ISC_SHOWUIALL = &hC000000F


' dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
Const CPS_COMPLETE = &h0001
Const CPS_CONVERT = &h0002
Const CPS_REVERT = &h0003
Const CPS_CANCEL = &h0004

' the modifiers of hot key
Const MOD_ALT = &h0001
Const MOD_CONTROL = &h0002
Const MOD_SHIFT = &h0004

Const MOD_LEFT = &h8000
Const MOD_RIGHT = &h4000

Const MOD_ON_KEYUP = &h0800
Const MOD_IGNORE_ALL_MODIFIER = &h0400


' Windows for Simplified Chinese Edition hot key ID from = &h10 - = &h2F
Const IME_CHOTKEY_IME_NONIME_TOGGLE = &h10
Const IME_CHOTKEY_SHAPE_TOGGLE = &h11
Const IME_CHOTKEY_SYMBOL_TOGGLE = &h12

' Windows for Japanese Edition hot key ID from = &h30 - = &h4F
Const IME_JHOTKEY_CLOSE_OPEN = &h30

' Windows for Korean Edition hot key ID from = &h50 - = &h6F
Const IME_KHOTKEY_SHAPE_TOGGLE = &h50
Const IME_KHOTKEY_HANJACONVERT = &h51
Const IME_KHOTKEY_ENGLISH = &h52

' Windows for Traditional Chinese Edition hot key ID from = &h70 - = &h8F
Const IME_THOTKEY_IME_NONIME_TOGGLE = &h70
Const IME_THOTKEY_SHAPE_TOGGLE = &h71
Const IME_THOTKEY_SYMBOL_TOGGLE = &h72

' direct switch hot key ID from = &h100 - = &h11F
Const IME_HOTKEY_DSWITCH_FIRST = &h100
Const IME_HOTKEY_DSWITCH_LAST = &h11F

' IME private hot key from = &h200 - = &h21F
Const IME_HOTKEY_PRIVATE_FIRST = &h200
Const IME_ITHOTKEY_RESEND_RESULTSTR = &h200
Const IME_ITHOTKEY_PREVIOUS_COMPOSITION = &h201
Const IME_ITHOTKEY_UISTYLE_TOGGLE = &h202
Const IME_ITHOTKEY_RECONVERTSTRING = &h203
Const IME_HOTKEY_PRIVATE_LAST = &h21F


' parameter of ImmGetCompositionString
Const GCS_COMPREADSTR = &h0001
Const GCS_COMPREADATTR = &h0002
Const GCS_COMPREADCLAUSE = &h0004
Const GCS_COMPSTR = &h0008
Const GCS_COMPATTR = &h0010
Const GCS_COMPCLAUSE = &h0020
Const GCS_CURSORPOS = &h0080
Const GCS_DELTASTART = &h0100
Const GCS_RESULTREADSTR = &h0200
Const GCS_RESULTREADCLAUSE = &h0400
Const GCS_RESULTSTR = &h0800
Const GCS_RESULTCLAUSE = &h1000

' style bit flags for WM_IME_COMPOSITION
Const CS_INSERTCHAR = &h2000
Const CS_NOMOVECARET = &h4000

' IME version constants
Const IMEVER_0310 = &h0003000A
Const IMEVER_0400 = &h00040000


' IME property bits
Const IME_PROP_AT_CARET = &h00010000
Const IME_PROP_SPECIAL_UI = &h00020000
Const IME_PROP_CANDLIST_START_FROM_1 = &h00040000
Const IME_PROP_UNICODE = &h00080000
Const IME_PROP_COMPLETE_ON_UNSELECT = &h00100000


' IME UICapability bits
Const UI_CAP_2700 = &h00000001
Const UI_CAP_ROT90 = &h00000002
Const UI_CAP_ROTANY = &h00000004

' ImmSetCompositionString Capability bits
Const SCS_CAP_COMPSTR = &h00000001
Const SCS_CAP_MAKEREAD = &h00000002
Const SCS_CAP_SETRECONVERTSTRING = &h00000004


' IME WM_IME_SELECT inheritance Capability bits
Const SELECT_CAP_CONVERSION = &h00000001
Const SELECT_CAP_SENTENCE = &h00000002


' ID for deIndex of ImmGetGuideLine
Const GGL_LEVEL = &h00000001
Const GGL_INDEX = &h00000002
Const GGL_STRING = &h00000003
Const GGL_PRIVATE = &h00000004


' ID for dwLevel of GUIDELINE Structure
Const GL_LEVEL_NOGUIDELINE = &h00000000
Const GL_LEVEL_FATAL = &h00000001
Const GL_LEVEL_ERROR = &h00000002
Const GL_LEVEL_WARNING = &h00000003
Const GL_LEVEL_INFORMATION = &h00000004


' ID for dwIndex of GUIDELINE Structure
Const GL_ID_UNKNOWN = &h00000000
Const GL_ID_NOMODULE = &h00000001
Const GL_ID_NODICTIONARY = &h00000010
Const GL_ID_CANNOTSAVE = &h00000011
Const GL_ID_NOCONVERT = &h00000020
Const GL_ID_TYPINGERROR = &h00000021
Const GL_ID_TOOMANYSTROKE = &h00000022
Const GL_ID_READINGCONFLICT = &h00000023
Const GL_ID_INPUTREADING = &h00000024
Const GL_ID_INPUTRADICAL = &h00000025
Const GL_ID_INPUTCODE = &h00000026
Const GL_ID_INPUTSYMBOL = &h00000027
Const GL_ID_CHOOSECANDIDATE = &h00000028
Const GL_ID_REVERSECONVERSION = &h00000029
Const GL_ID_PRIVATE_FIRST = &h00008000
Const GL_ID_PRIVATE_LAST = &h0000FFFF


' ID for dwIndex of ImmGetProperty
Const IGP_GETIMEVERSION = (-4 As DWord)
Const IGP_PROPERTY = &h00000004
Const IGP_CONVERSION = &h00000008
Const IGP_SENTENCE = &h0000000c
Const IGP_UI = &h00000010
Const IGP_SETCOMPSTR = &h00000014
Const IGP_SELECT = &h00000018

' dwIndex for ImmSetCompositionString API
Const SCS_SETSTR = (GCS_COMPREADSTR Or GCS_COMPSTR)
Const SCS_CHANGEATTR = (GCS_COMPREADATTR Or GCS_COMPATTR)
Const SCS_CHANGECLAUSE = (GCS_COMPREADCLAUSE Or GCS_COMPCLAUSE)
Const SCS_SETRECONVERTSTRING = &h00010000
Const SCS_QUERYRECONVERTSTRING = &h00020000

' attribute for COMPOSITIONSTRING Structure
Const ATTR_INPUT = &h00
Const ATTR_TARGET_CONVERTED = &h01
Const ATTR_CONVERTED = &h02
Const ATTR_TARGET_NOTCONVERTED = &h03
Const ATTR_INPUT_ERROR = &h04
Const ATTR_FIXEDCONVERTED = &h05

' bit field for IMC_SETCOMPOSITIONWINDOW, IMC_SETCANDIDATEWINDOW
Const CFS_DEFAULT = &h0000
Const CFS_RECT = &h0001
Const CFS_POINT = &h0002
Const CFS_FORCE_POSITION = &h0020
Const CFS_CANDIDATEPOS = &h0040
Const CFS_EXCLUDE = &h0080

' conversion direction for ImmGetConversionList
Const GCL_CONVERSION = &h0001
Const GCL_REVERSECONVERSION = &h0002
Const GCL_REVERSE_LENGTH = &h0003

' bit field for conversion mode
Const IME_CMODE_ALPHANUMERIC = &h0000
Const IME_CMODE_NATIVE = &h0001
Const IME_CMODE_CHINESE = IME_CMODE_NATIVE
' IME_CMODE_HANGEUL is old name of IME_CMODE_HANGUL. It will be gone eventually.
Const IME_CMODE_HANGEUL = IME_CMODE_NATIVE
Const IME_CMODE_HANGUL = IME_CMODE_NATIVE
Const IME_CMODE_JAPANESE = IME_CMODE_NATIVE
Const IME_CMODE_KATAKANA = &h0002 'only effect under IME_CMODE_NATIVE
Const IME_CMODE_LANGUAGE = &h0003
Const IME_CMODE_FULLSHAPE = &h0008
Const IME_CMODE_ROMAN = &h0010
Const IME_CMODE_CHARCODE = &h0020
Const IME_CMODE_HANJACONVERT = &h0040
Const IME_CMODE_SOFTKBD = &h0080
Const IME_CMODE_NOCONVERSION = &h0100
Const IME_CMODE_EUDC = &h0200
Const IME_CMODE_SYMBOL = &h0400
Const IME_CMODE_FIXED = &h0800
Const IME_CMODE_RESERVED = &hF0000000

' bit field for sentence mode
Const IME_SMODE_NONE = &h0000
Const IME_SMODE_PLAURALCLAUSE = &h0001
Const IME_SMODE_SINGLECONVERT = &h0002
Const IME_SMODE_AUTOMATIC = &h0004
Const IME_SMODE_PHRASEPREDICT = &h0008
Const IME_SMODE_CONVERSATION = &h0010
Const IME_SMODE_RESERVED = &h0000F000


' style of candidate
Const IME_CAND_UNKNOWN = &h0000
Const IME_CAND_READ = &h0001
Const IME_CAND_CODE = &h0002
Const IME_CAND_MEANING = &h0003
Const IME_CAND_RADICAL = &h0004
Const IME_CAND_STROKE = &h0005

' wParam of report message WM_IME_NOTIFY
Const IMN_CLOSESTATUSWINDOW = &h0001
Const IMN_OPENSTATUSWINDOW = &h0002
Const IMN_CHANGECANDIDATE = &h0003
Const IMN_CLOSECANDIDATE = &h0004
Const IMN_OPENCANDIDATE = &h0005
Const IMN_SETCONVERSIONMODE = &h0006
Const IMN_SETSENTENCEMODE = &h0007
Const IMN_SETOPENSTATUS = &h0008
Const IMN_SETCANDIDATEPOS = &h0009
Const IMN_SETCOMPOSITIONFONT = &h000A
Const IMN_SETCOMPOSITIONWINDOW = &h000B
Const IMN_SETSTATUSWINDOWPOS = &h000C
Const IMN_GUIDELINE = &h000D
Const IMN_PRIVATE = &h000E

' wParam of report message WM_IME_REQUEST
Const IMR_COMPOSITIONWINDOW = &h0001
Const IMR_CANDIDATEWINDOW = &h0002
Const IMR_COMPOSITIONFONT = &h0003
Const IMR_RECONVERTSTRING = &h0004
Const IMR_CONFIRMRECONVERTSTRING = &h0005
Const IMR_QUERYCHARPOSITION = &h0006
Const IMR_DOCUMENTFEED = &h0007

' error code of ImmGetCompositionString
Const IMM_ERROR_NODATA = (-1)
Const IMM_ERROR_GENERAL = (-2)


' dialog mode of ImmConfigureIME
Const IME_CONFIG_GENERAL = 1
Const IME_CONFIG_REGISTERWORD = 2
Const IME_CONFIG_SELECTDICTIONARY = 3


' flags for ImmEscape
Const IME_ESC_QUERY_SUPPORT = &h0003
Const IME_ESC_RESERVED_FIRST = &h0004
Const IME_ESC_RESERVED_LAST = &h07FF
Const IME_ESC_PRIVATE_FIRST = &h0800
Const IME_ESC_PRIVATE_LAST = &h0FFF

Const IME_ESC_SEQUENCE_TO_INTERNAL = &h1001
Const IME_ESC_GET_EUDC_DICTIONARY = &h1003
Const IME_ESC_SET_EUDC_DICTIONARY = &h1004
Const IME_ESC_MAX_KEY = &h1005
Const IME_ESC_IME_NAME = &h1006
Const IME_ESC_SYNC_HOTKEY = &h1007
Const IME_ESC_HANJA_MODE = &h1008
Const IME_ESC_AUTOMATA = &h1009
Const IME_ESC_PRIVATE_HOTKEY = &h100a
Const IME_ESC_GETHELPFILENAME = &h100b

' style of word registration
Const IME_REGWORD_STYLE_EUDC = &h00000001
Const IME_REGWORD_STYLE_USER_FIRST = &h80000000
Const IME_REGWORD_STYLE_USER_LAST = &hFFFFFFFF

' dwFlags for ImmAssociateContextEx
Const IACE_CHILDREN = &h0001
Const IACE_DEFAULT = &h0010
Const IACE_IGNORENOCONTEXT = &h0020

' dwFlags for ImmGetImeMenuItems
Const IGIMIF_RIGHTMENU = &h0001

' dwType for ImmGetImeMenuItems
Const IGIMII_CMODE = &h0001
Const IGIMII_SMODE = &h0002
Const IGIMII_CONFIGURE = &h0004
Const IGIMII_TOOLS = &h0008
Const IGIMII_HELP = &h0010
Const IGIMII_OTHER = &h0020
Const IGIMII_INPUTTOOLS = &h0040

' fType of IMEMENUITEMINFO structure
Const IMFT_RADIOCHECK = &h00001
Const IMFT_SEPARATOR = &h00002
Const IMFT_SUBMENU = &h00004

' fState of IMEMENUITEMINFO structure
Const IMFS_GRAYED = MFS_GRAYED
Const IMFS_DISABLED = MFS_DISABLED
Const IMFS_CHECKED = MFS_CHECKED
Const IMFS_HILITE = MFS_HILITE
Const IMFS_ENABLED = MFS_ENABLED
Const IMFS_UNCHECKED = MFS_UNCHECKED
Const IMFS_UNHILITE = MFS_UNHILITE
Const IMFS_DEFAULT = MFS_DEFAULT

' type of soft keyboard
' for Windows Tranditional Chinese Edition
Const SOFTKEYBOARD_TYPE_T1 = &h0001
' for Windows Simplified Chinese Edition
Const SOFTKEYBOARD_TYPE_C1 = &h0002
