' ########################################################################################
' Microsoft Windows
' File: Imm.inc
' Contents: Input Method Manager definitions
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_Imm_PBI)
#DEFINE PBX_Imm_PBI
%EQUATE `IMM_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
'typedef DWORD HIMC;
'typedef DWORD HIMCC;
'typedef HKL FAR *LPHKL;
'typedef UINT FAR *LPUINT;
' // Size = 28 bytes
TYPE COMPOSITIONFORM DWORD
 dwStyle AS DWORD ' DWORD dwStyle
 ptCurrentPos AS POINT ' POINT ptCurrentPos
 rcArea AS RECT ' RECT rcArea
END TYPE
' // Size = 32 bytes
TYPE CANDIDATEFORM DWORD
 dwIndex AS DWORD ' DWORD dwIndex
 dwStyle AS DWORD ' DWORD dwStyle
 ptCurrentPos AS POINT ' POINT ptCurrentPos
 rcArea AS RECT ' RECT rcArea
END TYPE
' // Size = 28 bytes
TYPE CANDIDATELIST DWORD ' ** NOT A REAL TYPE: for documentation purposes
 dwSize AS DWORD ' DWORD dwSize
 dwStyle AS DWORD ' DWORD dwStyle
 dwCount AS DWORD ' DWORD dwCount
 dwSelection AS DWORD ' DWORD dwSelection
 dwPageStart AS DWORD ' DWORD dwPageStart
 dwPageSize AS DWORD ' DWORD dwPageSize
 dwOffset(0) AS DWORD ' DWORD dwOffset[1]
END TYPE
'typedef struct tagREGISTERWORDA {
' ;
' ;
'} REGISTERWORDA, *PREGISTERWORDA, NEAR *NPREGISTERWORDA, FAR *LPREGISTERWORDA;
' // Size = 8 bytes
TYPE REGISTERWORDA DWORD
 lpReading AS ASCIIZ PTR ' LPSTR lpReading
 lpWord AS ASCIIZ PTR ' LPSTR lpWord
END TYPE
' // Size = 8 bytes
TYPE REGISTERWORDW DWORD
 lpReading AS WSTRINGZ PTR ' LPWSTR lpReading
 lpWord AS WSTRINGZ PTR ' LPWSTR lpWord
END TYPE
' MACRO REGISTERWORD = REGISTERWORDA
' Not allowed. Conflicts with the RegisterWord method of the IActiveIME interface.
' We need to use a duplicate type instead.
#IF %DEF(%UNICODE)
' // Size = 8 bytes
TYPE REGISTERWORD DWORD
 lpReading AS WSTRINGZ PTR ' LPWSTR lpReading
 lpWord AS WSTRINGZ PTR ' LPWSTR lpWord
END TYPE
#ELSE
' // Size = 8 bytes
TYPE REGISTERWORD DWORD
 lpReading AS ASCIIZ PTR ' LPSTR lpReading
 lpWord AS ASCIIZ PTR ' LPSTR lpWord
END TYPE
#ENDIF
'#if (WINVER >= 0x040A)
' // Size = 32 bytes
TYPE RECONVERTSTRING DWORD
 dwSize AS DWORD ' DWORD dwSize
 dwVersion AS DWORD ' DWORD dwVersion
 dwStrLen AS DWORD ' DWORD dwStrLen
 dwStrOffset AS DWORD ' DWORD dwStrOffset
 dwCompStrLen AS DWORD ' DWORD dwCompStrLen
 dwCompStrOffset AS DWORD ' DWORD dwCompStrOffset
 dwTargetStrLen AS DWORD ' DWORD dwTargetStrLen
 dwTargetStrOffset AS DWORD ' DWORD dwTargetStrOffset
END TYPE
'#endif /* WINVER >= 0x040A */
%EQUATE `STYLE_DESCRIPTION_SIZE = 32
' // Size = 36 bytes
TYPE STYLEBUFA DWORD
 dwStyle AS DWORD ' DWORD dwStyle
 szDescription AS ASCIIZ * %STYLE_DESCRIPTION_SIZE ' CHAR szDescription[STYLE_DESCRIPTION_SIZE]
END TYPE
' // Size = 68 bytes
TYPE STYLEBUFW DWORD
 dwStyle AS DWORD ' DWORD dwStyle
 szDescription AS WSTRINGZ * %STYLE_DESCRIPTION_SIZE ' WCHAR szDescription[STYLE_DESCRIPTION_SIZE]
END TYPE
#IF %DEF(%UNICODE)
MACRO STYLEBUF = STYLEBUFW
#ELSE
MACRO STYLEBUF = STYLEBUFA
#ENDIF
'#if (WINVER >= 0x040A)
%EQUATE `IMEMENUITEM_STRING_SIZE = 80
' // Size = 112 bytes
TYPE IMEMENUITEMINFOA DWORD
 cbSize AS DWORD ' UINT cbSize
 fType AS DWORD ' UINT fType
 fState AS DWORD ' UINT fState
 wID AS DWORD ' UINT wID
 hbmpChecked AS DWORD ' HBITMAP hbmpChecked
 hbmpUnchecked AS DWORD ' HBITMAP hbmpUnchecked
 dwItemData AS DWORD ' DWORD dwItemData
 szString AS ASCIIZ * %IMEMENUITEM_STRING_SIZE ' CHAR szString[IMEMENUITEM_STRING_SIZE]
 hbmpItem AS DWORD ' HBITMAP hbmpItem;
END TYPE
' // Size = 192 bytes
TYPE IMEMENUITEMINFOW DWORD
 cbSize AS DWORD ' UINT cbSize
 fType AS DWORD ' UINT fType
 fState AS DWORD ' UINT fState
 wID AS DWORD ' UINT wID
 hbmpChecked AS DWORD ' HBITMAP hbmpChecked
 hbmpUnchecked AS DWORD ' HBITMAP hbmpUnchecked
 dwItemData AS DWORD ' DWORD dwItemData
 szString AS WSTRINGZ * %IMEMENUITEM_STRING_SIZE ' WCHAR szString[IMEMENUITEM_STRING_SIZE]
 hbmpItem AS DWORD ' HBITMAP hbmpItem;
END TYPE
#IF %DEF(%UNICDE)
MACRO IMEMENUITEMINFO = IMEMENUITEMINFOW
#ELSE
MACRO IMEMENUITEMINFO = IMEMENUITEMINFOA
#ENDIF
' // Size = 36 bytes
TYPE IMECHARPOSITION DWORD
 dwSize AS DWORD ' DWORD dwSize
 dwCharPos AS DWORD ' DWORD dwCharPos
 pt AS POINT ' POINT pt
 cLineHeight AS DWORD ' UINT cLineHeight
 rcDocument AS RECT ' RECT rcDocument
END TYPE
'typedef BOOL (CALLBACK* IMCENUMPROC)(HIMC, LPARAM);
'#endif /* WINVER >= 0x040A */
'// prototype of IMM API
DECLARE FUNCTION ImmInstallIMEA LIB "imm32.dll" ALIAS "ImmInstallIMEA" ( BYREF lpszIMEFileName AS ASCIIZ , BYREF lpszLayoutText AS ASCIIZ ) AS QUAD ' HKL
DECLARE FUNCTION ImmInstallIMEW LIB "imm32.dll" ALIAS "ImmInstallIMEW" ( BYREF lpszIMEFileName AS WSTRINGZ , BYREF lpszLayoutText AS WSTRINGZ ) AS QUAD ' HKL
#IF %DEF(%UNICODE)
 MACRO ImmInstallIME = ImmInstallIMEW
#ELSE
 MACRO ImmInstallIME = ImmInstallIMEA
#ENDIF
DECLARE FUNCTION ImmGetDefaultIMEWnd LIB "imm32.dll" ALIAS "ImmGetDefaultIMEWnd" ( BYVAL hWnd AS QUAD ) AS QUAD
DECLARE FUNCTION ImmGetDescriptionA LIB "imm32.dll" ALIAS "ImmGetDescriptionA" ( BYVAL hKL AS QUAD
 , BYREF lpszDescription AS ASCIIZ
 , BYVAL uBufLen AS DWORD
 ) AS DWORD ' UINT
DECLARE FUNCTION ImmGetDescriptionW LIB "imm32.dll" ALIAS "ImmGetDescriptionW" ( BYVAL hKl AS QUAD , BYREF lpszDescription AS WSTRINGZ , BYVAL uBufLen AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO ImmGetDescription = ImmGetDescriptionW
#ELSE
 MACRO ImmGetDescription = ImmGetDescriptionA
#ENDIF
DECLARE FUNCTION ImmGetIMEFileNameA LIB "imm32.dll" ALIAS "ImmGetIMEFileNameA" ( BYVAL hKL AS QUAD , BYREF lpszFileName AS ASCIIZ , BYVAL uBufLen AS QUAD ) AS QUAD ' UINT
DECLARE FUNCTION ImmGetIMEFileNameW LIB "imm32.dll" ALIAS "ImmGetIMEFileNameW" ( BYVAL hKL AS QUAD , BYREF lpszFileName AS WSTRINGZ , BYVAL uBufLen AS QUAD ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO ImmGetIMEFileName = ImmGetIMEFileNameW
#ELSE
 MACRO ImmGetIMEFileName = ImmGetIMEFileNameA
#ENDIF
DECLARE FUNCTION ImmGetProperty LIB "imm32.dll" ALIAS "ImmGetProperty" ( BYVAL hKL AS QUAD , BYVAL fdwIndex AS QUAD ) AS QUAD
DECLARE FUNCTION ImmIsIME LIB "imm32.dll" ALIAS "ImmIsIME" ( BYVAL hKL AS QUAD
 ) AS LONG
DECLARE FUNCTION ImmSimulateHotKey LIB "imm32.dll" ALIAS "ImmSimulateHotKey" ( BYVAL hWnd AS DWORD
 , BYVAL dwHotKeyID AS DWORD
 ) AS LONG
DECLARE FUNCTION ImmCreateContext LIB "imm32.dll" ALIAS "ImmCreateContext" ( ) AS DWORD ' HIMC
DECLARE FUNCTION ImmDestroyContext LIB "imm32.dll" ALIAS "ImmDestroyContext" ( BYVAL hIMC AS QUAD ) AS LONG
DECLARE FUNCTION ImmGetContext LIB "imm32.dll" ALIAS "ImmGetContext" ( BYVAL hWnd AS QUAD
 ) AS DWORD ' HIMC
DECLARE FUNCTION ImmReleaseContext LIB "imm32.dll" ALIAS "ImmReleaseContext" ( BYVAL hWnd AS QUAD , BYVAL hIMC AS QUAD ) AS LONG
DECLARE FUNCTION ImmAssociateContext LIB "imm32.dll" ALIAS "ImmAssociateContext" ( BYVAL hWnd AS QUAD
 , BYVAL hIMC AS DWORD
 ) AS DWORD ' HIMC
'#if (WINVER >= 0x040A)
DECLARE FUNCTION ImmAssociateContextEx LIB "imm32.dll" ALIAS "ImmAssociateContextEx" ( BYVAL hWnd AS QUAD , BYVAL hIMC AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
'#endif /* WINVER >= 0x040A */
DECLARE FUNCTION ImmGetCompositionStringA LIB "imm32.dll" ALIAS "ImmGetCompositionStringA" ( BYVAL hIMC AS QUAD , BYVAL dwIndex AS QUAD , BYREF lpBuf AS ANY , BYVAL dwBufLen AS QUAD ) AS LONG
DECLARE FUNCTION ImmGetCompositionStringW LIB "imm32.dll" ALIAS "ImmGetCompositionStringW" ( BYVAL hIMC AS QUAD
 , BYVAL dwIndex AS DWORD
 , BYREF lpBuf AS ANY
 , BYVAL dwBufLen AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmGetCompositionString = ImmGetCompositionStringW
#ELSE
 MACRO ImmGetCompositionString = ImmGetCompositionStringA
#ENDIF
DECLARE FUNCTION ImmSetCompositionStringA LIB "imm32.dll" ALIAS "ImmSetCompositionStringA" ( BYVAL hIMC AS QUAD , BYVAL dwIndex AS QUAD , BYREF lpComp AS ANY , BYVAL dwCompLen AS QUAD , BYREF lpRead AS ANY , BYVAL dwReadLen AS QUAD ) AS LONG
DECLARE FUNCTION ImmSetCompositionStringW LIB "imm32.dll" ALIAS "ImmSetCompositionStringW" ( BYVAL hIMC AS QUAD
 , BYVAL dwIndex AS DWORD
 , BYREF lpComp AS ANY
 , BYVAL dwCompLen AS DWORD
 , BYREF lpRead AS ANY
 , BYVAL dwReadLen AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmSetCompositionString = ImmSetCompositionStringW
#ELSE
 MACRO ImmSetCompositionString = ImmSetCompositionStringA
#ENDIF
DECLARE FUNCTION ImmGetCandidateListCountA LIB "imm32.dll" ALIAS "ImmGetCandidateListCountA" ( BYVAL hIMC AS QUAD , BYREF lpdwListCount AS QUAD ) AS QUAD
DECLARE FUNCTION ImmGetCandidateListCountW LIB "imm32.dll" ALIAS "ImmGetCandidateListCountW" ( BYVAL hIMC AS QUAD
 , BYREF lpdwListCount AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO ImmGetCandidateListCount = ImmGetCandidateListCountW
#ELSE
 MACRO ImmGetCandidateListCount = ImmGetCandidateListCountA
#ENDIF
DECLARE FUNCTION ImmGetCandidateListA LIB "imm32.dll" ALIAS "ImmGetCandidateListA" ( BYVAL hIMC AS QUAD , BYVAL dwIndex AS QUAD , BYREF lpCandList AS CANDIDATELIST , BYVAL dwBufLen AS QUAD ) AS QUAD
DECLARE FUNCTION ImmGetCandidateListW LIB "imm32.dll" ALIAS "ImmGetCandidateListW" ( BYVAL hIMC AS QUAD
 , BYVAL dwIndex AS DWORD
 , BYREF lpCandList AS CANDIDATELIST
 , BYVAL dwBufLen AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO ImmGetCandidateList = ImmGetCandidateListW
#ELSE
 MACRO ImmGetCandidateList = ImmGetCandidateListA
#ENDIF
DECLARE FUNCTION ImmGetGuideLineA LIB "imm32.dll" ALIAS "ImmGetGuideLineA" ( BYVAL hIMC AS QUAD , BYVAL dwIndex AS QUAD , BYREF lpBuf AS ASCIIZ , BYVAL dwBufLen AS QUAD ) AS QUAD
DECLARE FUNCTION ImmGetGuideLineW LIB "imm32.dll" ALIAS "ImmGetGuideLineW" ( BYVAL hIMC AS QUAD
 , BYVAL dwIndex AS DWORD
 , BYREF lpBuf AS WSTRINGZ
 , BYVAL dwBufLen AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO ImmGetGuideLine = ImmGetGuideLineW
#ELSE
 MACRO ImmGetGuideLine = ImmGetGuideLineA
#ENDIF
DECLARE FUNCTION ImmGetConversionStatus LIB "imm32.dll" ALIAS "ImmGetConversionStatus" ( BYVAL hIMC AS QUAD , BYREF lpfdwConversion AS QUAD , BYREF lpfdwSentence AS QUAD ) AS LONG
DECLARE FUNCTION ImmSetConversionStatus LIB "imm32.dll" ALIAS "ImmSetConversionStatus" ( BYVAL hIMC AS QUAD
 , BYVAL fdwConversion AS DWORD
 , BYVAL fdwSentence AS DWORD
 ) AS LONG
DECLARE FUNCTION ImmGetOpenStatus LIB "imm32.dll" ALIAS "ImmGetOpenStatus" ( BYVAL hIMC AS DWORD
 ) AS LONG
DECLARE FUNCTION ImmSetOpenStatus LIB "imm32.dll" ALIAS "ImmSetOpenStatus" ( BYVAL hIMC AS DWORD
 , BYVAL fOpen AS LONG
 ) AS LONG
#IF NOT %DEF(%NOGDI)
'#if defined(_WINGDI_) && !defined(NOGDI)
DECLARE FUNCTION ImmGetCompositionFontA LIB "imm32.dll" ALIAS "ImmGetCompositionFontA" ( BYVAL hIMC AS QUAD , BYREF lplf AS LOGFONTA ) AS LONG
DECLARE FUNCTION ImmGetCompositionFontW LIB "imm32.dll" ALIAS "ImmGetCompositionFontW" ( BYVAL hIMC AS QUAD
 , BYREF lplf AS LOGFONTW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmGetCompositionFont = ImmGetCompositionFontW
#ELSE
 MACRO ImmGetCompositionFont = ImmGetCompositionFontA
#ENDIF
DECLARE FUNCTION ImmSetCompositionFontA LIB "imm32.dll" ALIAS "ImmSetCompositionFontA" ( BYVAL hIMC AS QUAD , BYREF lplf AS LOGFONTA ) AS LONG
DECLARE FUNCTION ImmSetCompositionFontW LIB "imm32.dll" ALIAS "ImmSetCompositionFontW" ( BYVAL hIMC AS QUAD
 , BYREF lplf AS LOGFONTW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmSetCompositionFont = ImmSetCompositionFontW
#ELSE
 MACRO ImmSetCompositionFont = ImmSetCompositionFontA
#ENDIF
#ENDIF ' #IF NOT %DEF(%NOGDI)
DECLARE FUNCTION ImmConfigureIMEA LIB "imm32.dll" ALIAS "ImmConfigureIMEA" ( BYVAL hKL AS QUAD , BYVAL hWnd AS QUAD , BYVAL dwMode AS QUAD , BYREF lpData AS ANY ) AS LONG
DECLARE FUNCTION ImmConfigureIMEW LIB "imm32.dll" ALIAS "ImmConfigureIMEW" ( BYVAL hKL AS QUAD
 , BYVAL hWnd AS DWORD
 , BYVAL dwMode AS DWORD
 , BYREF lpData AS ANY
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmConfigureIME = ImmConfigureIMEW
#ELSE
 MACRO ImmConfigureIME = ImmConfigureIMEA
#ENDIF
DECLARE FUNCTION ImmEscapeA LIB "imm32.dll" ALIAS "ImmEscapeA" ( BYVAL hKL AS QUAD , BYVAL hIMC AS QUAD , BYVAL uEscape AS QUAD , BYREF lpData AS ANY ) AS LONG ' LRESULT
DECLARE FUNCTION ImmEscapeW LIB "imm32.dll" ALIAS "ImmEscapeW" ( BYVAL hKL AS QUAD , BYVAL hIMC AS QUAD , BYVAL uEscape AS QUAD , BYREF lpData AS ANY ) AS LONG ' LRESULT
#IF %DEF(%UNICODE)
 MACRO ImmEscape = ImmEscapeW
#ELSE
 MACRO ImmEscape = ImmEscapeA
#ENDIF
DECLARE FUNCTION ImmGetConversionListA LIB "imm32.dll" ALIAS "ImmGetConversionListA" ( BYVAL hKL AS QUAD , BYVAL hIMC AS QUAD , BYREF lpSrc AS ASCIIZ , BYREF lpDst AS CANDIDATELIST , BYVAL dwBufLen AS QUAD , BYVAL uFlag AS QUAD ) AS QUAD
DECLARE FUNCTION ImmGetConversionListW LIB "imm32.dll" ALIAS "ImmGetConversionListW" ( BYVAL hKL AS QUAD
 , BYVAL hIMC AS DWORD
 , BYREF lpSrc AS WSTRINGZ
 , BYREF lpDst AS CANDIDATELIST
 , BYVAL dwBufLen AS DWORD
 , BYVAL uFlag AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO ImmGetConversionList = ImmGetConversionListW
#ELSE
 MACRO ImmGetConversionList = ImmGetConversionListA
#ENDIF
DECLARE FUNCTION ImmNotifyIME LIB "imm32.dll" ALIAS "ImmNotifyIME" ( BYVAL hIMC AS QUAD , BYVAL dwAction AS QUAD , BYVAL dwIndex AS QUAD , BYVAL dwValue AS QUAD ) AS LONG
DECLARE FUNCTION ImmGetStatusWindowPos LIB "imm32.dll" ALIAS "ImmGetStatusWindowPos" ( BYVAL hIMC AS QUAD
 , BYREF lpptPos AS POINT
 ) AS LONG
DECLARE FUNCTION ImmSetStatusWindowPos LIB "imm32.dll" ALIAS "ImmSetStatusWindowPos" ( BYVAL hIMC AS DWORD
 , BYREF lpptPos AS POINT
 ) AS LONG
DECLARE FUNCTION ImmGetCompositionWindow LIB "imm32.dll" ALIAS "ImmGetCompositionWindow" ( BYVAL hIMC AS DWORD
 , BYREF lpCompForm AS COMPOSITIONFORM
 ) AS LONG
DECLARE FUNCTION ImmSetCompositionWindow LIB "imm32.dll" ALIAS "ImmSetCompositionWindow" ( BYVAL hIMC AS DWORD
 , BYREF lpCompForm AS COMPOSITIONFORM
 ) AS LONG
DECLARE FUNCTION ImmGetCandidateWindow LIB "imm32.dll" ALIAS "ImmGetCandidateWindow" ( BYVAL hIMC AS DWORD
 , BYVAL dwIndex AS DWORD
 , BYREF lpCandidate AS CANDIDATEFORM
 ) AS LONG
DECLARE FUNCTION ImmSetCandidateWindow LIB "imm32.dll" ALIAS "ImmSetCandidateWindow" ( BYVAL hIMC AS DWORD
 , BYREF lpCandidate AS CANDIDATEFORM
 ) AS LONG
DECLARE FUNCTION ImmIsUIMessageA LIB "imm32.dll" ALIAS "ImmIsUIMessageA" ( BYVAL hWndIME AS DWORD
 , BYVAL msg AS DWORD
 , BYVAL wParam AS DWORD
 , BYVAL lParam AS LONG
 ) AS LONG
DECLARE FUNCTION ImmIsUIMessageW LIB "imm32.dll" ALIAS "ImmIsUIMessageW" ( BYVAL hWndIME AS DWORD
 , BYVAL msg AS DWORD
 , BYVAL wParam AS DWORD
 , BYVAL lParam AS LONG
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmIsUIMessage = ImmIsUIMessageW
#ELSE
 MACRO ImmIsUIMessage = ImmIsUIMessageA
#ENDIF
DECLARE FUNCTION ImmGetVirtualKey LIB "imm32.dll" ALIAS "ImmGetVirtualKey" ( BYVAL hWnd AS QUAD ) AS QUAD ' UINT
'typedef int (CALLBACK *REGISTERWORDENUMPROCA)(LPCSTR, DWORD, LPCSTR, LPVOID);
'typedef int (CALLBACK *REGISTERWORDENUMPROCW)(LPCWSTR, DWORD, LPCWSTR, LPVOID);
'#endif // !UNICODE
DECLARE FUNCTION ImmRegisterWordA LIB "imm32.dll" ALIAS "ImmRegisterWordA" ( BYVAL hKL AS QUAD , BYREF lpszReading AS ASCIIZ , BYVAL dwStyle AS QUAD , BYREF lpszRegister AS ASCIIZ ) AS LONG
DECLARE FUNCTION ImmRegisterWordW LIB "imm32.dll" ALIAS "ImmRegisterWordW" ( BYVAL hKL AS QUAD
 , BYREF lpszReading AS WSTRINGZ
 , BYVAL dwStyle AS DWORD
 , BYREF lpszRegister AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmRegisterWord = ImmRegisterWordW
#ELSE
 MACRO ImmRegisterWord = ImmRegisterWordA
#ENDIF
DECLARE FUNCTION ImmUnregisterWordA LIB "imm32.dll" ALIAS "ImmUnregisterWordA" ( BYVAL hKL AS QUAD , BYREF lpszReading AS ASCIIZ , BYVAL dwStyle AS QUAD , BYREF lpszUnregister AS ASCIIZ ) AS LONG
DECLARE FUNCTION ImmUnregisterWordW LIB "imm32.dll" ALIAS "ImmUnregisterWordW" ( BYVAL hKL AS QUAD
 , BYREF lpszReading AS WSTRINGZ
 , BYVAL dwStyle AS DWORD
 , BYREF lpszUnregister AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO ImmUnregisterWord = ImmUnregisterWordW
#ELSE
 MACRO ImmUnregisterWord = ImmUnregisterWordA
#ENDIF
DECLARE FUNCTION ImmGetRegisterWordStyleA LIB "imm32.dll" ALIAS "ImmGetRegisterWordStyleA" ( BYVAL hKL AS QUAD , BYVAL nItem AS QUAD , BYREF lpStyleBuf AS STYLEBUFA ) AS QUAD ' UINT
DECLARE FUNCTION ImmGetRegisterWordStyleW LIB "imm32.dll" ALIAS "ImmGetRegisterWordStyleW" ( BYVAL hKL AS QUAD , BYVAL nItem AS QUAD , BYREF lpStyleBuf AS STYLEBUFW ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO ImmGetRegisterWordStyle = ImmGetRegisterWordStyleW
#ELSE
 MACRO ImmGetRegisterWordStyle = ImmGetRegisterWordStyleA
#ENDIF
DECLARE FUNCTION ImmEnumRegisterWordA LIB "imm32.dll" ALIAS "ImmEnumRegisterWordA" ( BYVAL hKL AS QUAD , BYVAL lpfnEnumProc AS QUAD , BYREF lpszReading AS ASCIIZ , BYVAL dwStyle AS QUAD , BYREF lpszRegister AS ASCIIZ , BYREF lpData AS ANY ) AS QUAD ' UINT
DECLARE FUNCTION ImmEnumRegisterWordW LIB "imm32.dll" ALIAS "ImmEnumRegisterWordW" ( BYVAL hKL AS QUAD , BYVAL lpfnEnumProc AS QUAD , BYREF lpszReading AS WSTRINGZ , BYVAL dwStyle AS QUAD , BYREF lpszRegister AS WSTRINGZ , BYREF lpData AS ANY ) AS QUAD ' UINT
#IF %DEF(%UNICODE)
 MACRO ImmEnumRegisterWord = ImmEnumRegisterWordW
#ELSE
 MACRO ImmEnumRegisterWord = ImmEnumRegisterWordA
#ENDIF
'#if (WINVER >= 0x040A)
DECLARE FUNCTION ImmDisableIME LIB "imm32.dll" ALIAS "ImmDisableIME" ( BYVAL idThread AS QUAD ) AS LONG
DECLARE FUNCTION ImmEnumInputContext LIB "imm32.dll" ALIAS "ImmEnumInputContext" ( BYVAL idThread AS QUAD
 , BYVAL lpfn AS DWORD
 , BYVAL lParam AS LONG
 ) AS LONG
DECLARE FUNCTION ImmGetImeMenuItemsA LIB "imm32.dll" ALIAS "ImmGetImeMenuItemsA" ( BYVAL hIMC AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYVAL dwType AS DWORD
 , BYREF lpImeParentMenu AS IMEMENUITEMINFOA
 , BYREF lpImeMenu AS IMEMENUITEMINFOA
 , BYVAL dwSize AS DWORD
 ) AS DWORD
DECLARE FUNCTION ImmGetImeMenuItemsW LIB "imm32.dll" ALIAS "ImmGetImeMenuItemsW" ( BYVAL hIMC AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYVAL dwType AS DWORD
 , BYREF lpImeParentMenu AS IMEMENUITEMINFOW
 , BYREF lpImeMenu AS IMEMENUITEMINFOW
 , BYVAL dwSize AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO ImmGetImeMenuItems = ImmGetImeMenuItemsW
#ELSE
 MACRO ImmGetImeMenuItems = ImmGetImeMenuItemsA
#ENDIF
DECLARE FUNCTION ImmDisableTextFrameService LIB "imm32.dll" ALIAS "ImmDisableTextFrameService" ( BYVAL idThread AS QUAD ) AS LONG
'#endif /* WINVER >= 0x040A */
'// wParam for WM_IME_CONTROL
%EQUATE `IMC_GETCANDIDATEPOS = &H0007
%EQUATE `IMC_SETCANDIDATEPOS = &H0008
%EQUATE `IMC_GETCOMPOSITIONFONT = &H0009
%EQUATE `IMC_SETCOMPOSITIONFONT = &H000A
%EQUATE `IMC_GETCOMPOSITIONWINDOW = &H000B
%EQUATE `IMC_SETCOMPOSITIONWINDOW = &H000C
%EQUATE `IMC_GETSTATUSWINDOWPOS = &H000F
%EQUATE `IMC_SETSTATUSWINDOWPOS = &H0010
%EQUATE `IMC_CLOSESTATUSWINDOW = &H0021
%EQUATE `IMC_OPENSTATUSWINDOW = &H0022
'// dwAction for ImmNotifyIME
%EQUATE `NI_OPENCANDIDATE = &H0010
%EQUATE `NI_CLOSECANDIDATE = &H0011
%EQUATE `NI_SELECTCANDIDATESTR = &H0012
%EQUATE `NI_CHANGECANDIDATELIST = &H0013
%EQUATE `NI_FINALIZECONVERSIONRESULT = &H0014
%EQUATE `NI_COMPOSITIONSTR = &H0015
%EQUATE `NI_SETCANDIDATE_PAGESTART = &H0016
%EQUATE `NI_SETCANDIDATE_PAGESIZE = &H0017
%EQUATE `NI_IMEMENUSELECTED = &H0018
'// lParam for WM_IME_SETCONTEXT
%EQUATE `ISC_SHOWUICANDIDATEWINDOW = &H00000001
%EQUATE `ISC_SHOWUICOMPOSITIONWINDOW = &H80000000
%EQUATE `ISC_SHOWUIGUIDELINE = &H40000000
%EQUATE `ISC_SHOWUIALLCANDIDATEWINDOW = &H0000000F
%EQUATE `ISC_SHOWUIALL = &HC000000F
'// dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
%EQUATE `CPS_COMPLETE = &H0001
%EQUATE `CPS_CONVERT = &H0002
%EQUATE `CPS_REVERT = &H0003
%EQUATE `CPS_CANCEL = &H0004
'// the modifiers of hot key
%EQUATE `MOD_ALT = &H0001
%EQUATE `MOD_CONTROL = &H0002
%EQUATE `MOD_SHIFT = &H0004
%EQUATE `MOD_LEFT = &H8000
%EQUATE `MOD_RIGHT = &H4000
%EQUATE `MOD_ON_KEYUP = &H0800
%EQUATE `MOD_IGNORE_ALL_MODIFIER = &H0400
'// Windows for Simplified Chinese Edition hot key ID from 0x10 - 0x2F
%EQUATE `IME_CHOTKEY_IME_NONIME_TOGGLE = &H10
%EQUATE `IME_CHOTKEY_SHAPE_TOGGLE = &H11
%EQUATE `IME_CHOTKEY_SYMBOL_TOGGLE = &H12
'// Windows for Japanese Edition hot key ID from 0x30 - 0x4F
%EQUATE `IME_JHOTKEY_CLOSE_OPEN = &H30
'// Windows for Korean Edition hot key ID from 0x50 - 0x6F
%EQUATE `IME_KHOTKEY_SHAPE_TOGGLE = &H50
%EQUATE `IME_KHOTKEY_HANJACONVERT = &H51
%EQUATE `IME_KHOTKEY_ENGLISH = &H52
'// Windows for Traditional Chinese Edition hot key ID from 0x70 - 0x8F
%EQUATE `IME_THOTKEY_IME_NONIME_TOGGLE = &H70
%EQUATE `IME_THOTKEY_SHAPE_TOGGLE = &H71
%EQUATE `IME_THOTKEY_SYMBOL_TOGGLE = &H72
'// direct switch hot key ID from 0x100 - 0x11F
%EQUATE `IME_HOTKEY_DSWITCH_FIRST = &H100
%EQUATE `IME_HOTKEY_DSWITCH_LAST = &H11F
'// IME private hot key from 0x200 - 0x21F
%EQUATE `IME_HOTKEY_PRIVATE_FIRST = &H200
%EQUATE `IME_ITHOTKEY_RESEND_RESULTSTR = &H200
%EQUATE `IME_ITHOTKEY_PREVIOUS_COMPOSITION = &H201
%EQUATE `IME_ITHOTKEY_UISTYLE_TOGGLE = &H202
%EQUATE `IME_ITHOTKEY_RECONVERTSTRING = &H203
%EQUATE `IME_HOTKEY_PRIVATE_LAST = &H21F
'// parameter of ImmGetCompositionString
%EQUATE `GCS_COMPREADSTR = &H0001
%EQUATE `GCS_COMPREADATTR = &H0002
%EQUATE `GCS_COMPREADCLAUSE = &H0004
%EQUATE `GCS_COMPSTR = &H0008
%EQUATE `GCS_COMPATTR = &H0010
%EQUATE `GCS_COMPCLAUSE = &H0020
%EQUATE `GCS_CURSORPOS = &H0080
%EQUATE `GCS_DELTASTART = &H0100
%EQUATE `GCS_RESULTREADSTR = &H0200
%EQUATE `GCS_RESULTREADCLAUSE = &H0400
%EQUATE `GCS_RESULTSTR = &H0800
%EQUATE `GCS_RESULTCLAUSE = &H1000
'// style bit flags for WM_IME_COMPOSITION
%EQUATE `CS_INSERTCHAR = &H2000
%EQUATE `CS_NOMOVECARET = &H4000
'// IME version constants
%EQUATE `IMEVER_0310 = &H0003000A
%EQUATE `IMEVER_0400 = &H00040000
'// IME property bits
%EQUATE `IME_PROP_AT_CARET = &H00010000
%EQUATE `IME_PROP_SPECIAL_UI = &H00020000
%EQUATE `IME_PROP_CANDLIST_START_FROM_1 = &H00040000
%EQUATE `IME_PROP_UNICODE = &H00080000
%EQUATE `IME_PROP_COMPLETE_ON_UNSELECT = &H00100000
'// IME UICapability bits
%EQUATE `UI_CAP_2700 = &H00000001
%EQUATE `UI_CAP_ROT90 = &H00000002
%EQUATE `UI_CAP_ROTANY = &H00000004
'// ImmSetCompositionString Capability bits
%EQUATE `SCS_CAP_COMPSTR = &H00000001
%EQUATE `SCS_CAP_MAKEREAD = &H00000002
%EQUATE `SCS_CAP_SETRECONVERTSTRING = &H00000004
'// IME WM_IME_SELECT inheritance Capability bits
%EQUATE `SELECT_CAP_CONVERSION = &H00000001
%EQUATE `SELECT_CAP_SENTENCE = &H00000002
'// ID for dwIndex of ImmGetGuideLine
%EQUATE `GGL_LEVEL = &H00000001
%EQUATE `GGL_INDEX = &H00000002
%EQUATE `GGL_STRING = &H00000003
%EQUATE `GGL_PRIVATE = &H00000004
'// ID for dwLevel of GUIDELINE Structure
%EQUATE `GL_LEVEL_NOGUIDELINE = &H00000000
%EQUATE `GL_LEVEL_FATAL = &H00000001
%EQUATE `GL_LEVEL_ERROR = &H00000002
%EQUATE `GL_LEVEL_WARNING = &H00000003
%EQUATE `GL_LEVEL_INFORMATION = &H00000004
'// ID for dwIndex of GUIDELINE Structure
%EQUATE `GL_ID_UNKNOWN = &H00000000
%EQUATE `GL_ID_NOMODULE = &H00000001
%EQUATE `GL_ID_NODICTIONARY = &H00000010
%EQUATE `GL_ID_CANNOTSAVE = &H00000011
%EQUATE `GL_ID_NOCONVERT = &H00000020
%EQUATE `GL_ID_TYPINGERROR = &H00000021
%EQUATE `GL_ID_TOOMANYSTROKE = &H00000022
%EQUATE `GL_ID_READINGCONFLICT = &H00000023
%EQUATE `GL_ID_INPUTREADING = &H00000024
%EQUATE `GL_ID_INPUTRADICAL = &H00000025
%EQUATE `GL_ID_INPUTCODE = &H00000026
%EQUATE `GL_ID_INPUTSYMBOL = &H00000027
%EQUATE `GL_ID_CHOOSECANDIDATE = &H00000028
%EQUATE `GL_ID_REVERSECONVERSION = &H00000029
%EQUATE `GL_ID_PRIVATE_FIRST = &H00008000
%EQUATE `GL_ID_PRIVATE_LAST = &H0000FFFF
'// ID for dwIndex of ImmGetProperty
%EQUATE `IGP_GETIMEVERSION = &HFFFFFFFC ' (DWORD)(-4)
%EQUATE `IGP_PROPERTY = &H00000004
%EQUATE `IGP_CONVERSION = &H00000008
%EQUATE `IGP_SENTENCE = &H0000000c
%EQUATE `IGP_UI = &H00000010
%EQUATE `IGP_SETCOMPSTR = &H00000014
%EQUATE `IGP_SELECT = &H00000018
'// dwIndex for ImmSetCompositionString API
%EQUATE `SCS_SETSTR = %GCS_COMPREADSTR OR %GCS_COMPSTR
%EQUATE `SCS_CHANGEATTR = %GCS_COMPREADATTR OR %GCS_COMPATTR
%EQUATE `SCS_CHANGECLAUSE = %GCS_COMPREADCLAUSE OR %GCS_COMPCLAUSE
%EQUATE `SCS_SETRECONVERTSTRING = &H00010000
%EQUATE `SCS_QUERYRECONVERTSTRING = &H00020000
'// attribute for COMPOSITIONSTRING Structure
%EQUATE `ATTR_INPUT = &H00
%EQUATE `ATTR_TARGET_CONVERTED = &H01
%EQUATE `ATTR_CONVERTED = &H02
%EQUATE `ATTR_TARGET_NOTCONVERTED = &H03
%EQUATE `ATTR_INPUT_ERROR = &H04
%EQUATE `ATTR_FIXEDCONVERTED = &H05
'// bit field for IMC_SETCOMPOSITIONWINDOW, IMC_SETCANDIDATEWINDOW
%EQUATE `CFS_DEFAULT = &H0000
%EQUATE `CFS_RECT = &H0001
%EQUATE `CFS_POINT = &H0002
%EQUATE `CFS_FORCE_POSITION = &H0020
%EQUATE `CFS_CANDIDATEPOS = &H0040
%EQUATE `CFS_EXCLUDE = &H0080
'// conversion direction for ImmGetConversionList
%EQUATE `GCL_CONVERSION = &H0001
%EQUATE `GCL_REVERSECONVERSION = &H0002
%EQUATE `GCL_REVERSE_LENGTH = &H0003
#INCLUDE ONCE "Legacy/System/Ime_cmodes.inc"
'// IME_CMODE_HANGEUL is old name of IME_CMODE_HANGUL. It will be gone eventually.
%EQUATE `IME_CMODE_HANGEUL = %IME_CMODE_NATIVE
%EQUATE `IME_CMODE_SOFTKBD = &H0080
%EQUATE `IME_CMODE_NOCONVERSION = &H0100
%EQUATE `IME_CMODE_EUDC = &H0200
%EQUATE `IME_CMODE_SYMBOL = &H0400
%EQUATE `IME_CMODE_FIXED = &H0800
%EQUATE `IME_CMODE_RESERVED = &HF0000000
'// bit field for sentence mode
%EQUATE `IME_SMODE_NONE = &H0000
%EQUATE `IME_SMODE_PLAURALCLAUSE = &H0001
%EQUATE `IME_SMODE_SINGLECONVERT = &H0002
%EQUATE `IME_SMODE_AUTOMATIC = &H0004
%EQUATE `IME_SMODE_PHRASEPREDICT = &H0008
%EQUATE `IME_SMODE_CONVERSATION = &H0010
%EQUATE `IME_SMODE_RESERVED = &H0000F000
'// style of candidate
%EQUATE `IME_CAND_UNKNOWN = &H0000
%EQUATE `IME_CAND_READ = &H0001
%EQUATE `IME_CAND_CODE = &H0002
%EQUATE `IME_CAND_MEANING = &H0003
%EQUATE `IME_CAND_RADICAL = &H0004
%EQUATE `IME_CAND_STROKE = &H0005
'// wParam of report message WM_IME_NOTIFY
%EQUATE `IMN_CLOSESTATUSWINDOW = &H0001
%EQUATE `IMN_OPENSTATUSWINDOW = &H0002
%EQUATE `IMN_CHANGECANDIDATE = &H0003
%EQUATE `IMN_CLOSECANDIDATE = &H0004
%EQUATE `IMN_OPENCANDIDATE = &H0005
%EQUATE `IMN_SETCONVERSIONMODE = &H0006
%EQUATE `IMN_SETSENTENCEMODE = &H0007
%EQUATE `IMN_SETOPENSTATUS = &H0008
%EQUATE `IMN_SETCANDIDATEPOS = &H0009
%EQUATE `IMN_SETCOMPOSITIONFONT = &H000A
%EQUATE `IMN_SETCOMPOSITIONWINDOW = &H000B
%EQUATE `IMN_SETSTATUSWINDOWPOS = &H000C
%EQUATE `IMN_GUIDELINE = &H000D
%EQUATE `IMN_PRIVATE = &H000E
'#if (WINVER >= 0x040A)
'// wParam of report message WM_IME_REQUEST
%EQUATE `IMR_COMPOSITIONWINDOW = &H0001
%EQUATE `IMR_CANDIDATEWINDOW = &H0002
%EQUATE `IMR_COMPOSITIONFONT = &H0003
%EQUATE `IMR_RECONVERTSTRING = &H0004
%EQUATE `IMR_CONFIRMRECONVERTSTRING = &H0005
%EQUATE `IMR_QUERYCHARPOSITION = &H0006
%EQUATE `IMR_DOCUMENTFEED = &H0007
'#endif /* WINVER >= 0x040A */
'// error code of ImmGetCompositionString
%EQUATE `IMM_ERROR_NODATA = -1
%EQUATE `IMM_ERROR_GENERAL = -2
'// dialog mode of ImmConfigureIME
%EQUATE `IME_CONFIG_GENERAL = 1
%EQUATE `IME_CONFIG_REGISTERWORD = 2
%EQUATE `IME_CONFIG_SELECTDICTIONARY = 3
'// flags for ImmEscape
%EQUATE `IME_ESC_QUERY_SUPPORT = &H0003
%EQUATE `IME_ESC_RESERVED_FIRST = &H0004
%EQUATE `IME_ESC_RESERVED_LAST = &H07FF
%EQUATE `IME_ESC_PRIVATE_FIRST = &H0800
%EQUATE `IME_ESC_PRIVATE_LAST = &H0FFF
%EQUATE `IME_ESC_SEQUENCE_TO_INTERNAL = &H1001
%EQUATE `IME_ESC_GET_EUDC_DICTIONARY = &H1003
%EQUATE `IME_ESC_SET_EUDC_DICTIONARY = &H1004
%EQUATE `IME_ESC_MAX_KEY = &H1005
%EQUATE `IME_ESC_IME_NAME = &H1006
%EQUATE `IME_ESC_SYNC_HOTKEY = &H1007
%EQUATE `IME_ESC_HANJA_MODE = &H1008
%EQUATE `IME_ESC_AUTOMATA = &H1009
%EQUATE `IME_ESC_PRIVATE_HOTKEY = &H100a
%EQUATE `IME_ESC_GETHELPFILENAME = &H100b
'// style of word registration
%EQUATE `IME_REGWORD_STYLE_EUDC = &H00000001
%EQUATE `IME_REGWORD_STYLE_USER_FIRST = &H80000000
%EQUATE `IME_REGWORD_STYLE_USER_LAST = &HFFFFFFFF
'#if (WINVER >= 0x040A)
'// dwFlags for ImmAssociateContextEx
%EQUATE `IACE_CHILDREN = &H0001
%EQUATE `IACE_DEFAULT = &H0010
%EQUATE `IACE_IGNORENOCONTEXT = &H0020
'// dwFlags for ImmGetImeMenuItems
%EQUATE `IGIMIF_RIGHTMENU = &H0001
'// dwType for ImmGetImeMenuItems
%EQUATE `IGIMII_CMODE = &H0001
%EQUATE `IGIMII_SMODE = &H0002
%EQUATE `IGIMII_CONFIGURE = &H0004
%EQUATE `IGIMII_TOOLS = &H0008
%EQUATE `IGIMII_HELP = &H0010
%EQUATE `IGIMII_OTHER = &H0020
%EQUATE `IGIMII_INPUTTOOLS = &H0040
'// fType of IMEMENUITEMINFO structure
%EQUATE `IMFT_RADIOCHECK = &H00001
%EQUATE `IMFT_SEPARATOR = &H00002
%EQUATE `IMFT_SUBMENU = &H00004
'// fState of IMEMENUITEMINFO structure
%EQUATE `IMFS_GRAYED = %MFS_GRAYED
%EQUATE `IMFS_DISABLED = %MFS_DISABLED
%EQUATE `IMFS_CHECKED = %MFS_CHECKED
%EQUATE `IMFS_HILITE = %MFS_HILITE
%EQUATE `IMFS_ENABLED = %MFS_ENABLED
%EQUATE `IMFS_UNCHECKED = %MFS_UNCHECKED
%EQUATE `IMFS_UNHILITE = %MFS_UNHILITE
%EQUATE `IMFS_DEFAULT = %MFS_DEFAULT
'#endif /* WINVER >= 0x040A */
'// type of soft keyboard
'// for Windows Tranditional Chinese Edition
%EQUATE `SOFTKEYBOARD_TYPE_T1 = &H0001
'// for Windows Simplified Chinese Edition
%EQUATE `SOFTKEYBOARD_TYPE_C1 = &H0002
#ENDIF
