Input Method Instance
Input Method Instance is a contextual unit which holds the several states related to the user input. It is actually a data block which is allocated by system. The data structure is directly accessible through a long value handle(HIMI) by calling ImRequestIMInstance, which gives IME the memory address of the structure. After IME refers to or change the IMInstance contents, IME should release IMInstance by calling ImReleaseIMInstance call. IMInstance itself has the following structure.
IMINSTANCE { /* Size of this structure */ ULONG ulSize; /* Information related to the client application */ ULONG ulSessionType; HWND hwnd; ULONG ulSessionID; ULONG ulClientInfo; ULONG ulCodepage; /* Status part */ HIMIP himipStatus; ULONG ulInputMode; ULONG ulConversionMode; POINTL ptlStatusPos; SIZEL slStatusSize; /* Conversion part */ HIMIP himipConversion; FATTRS faConversionWindow; GRADIENTL gradlConversionWindow; SIZEF sfCharBox; CONVERSIONPOS cpConversionPos; /* Result part */ HIMIP himipResult; /* Candidate part */ HIMIP himipCandidate; CANDIDATEPOS cpCandidatePos; /* Information message part */ HIMIP himipInfoMsg; /* Register word part */ HIMIP himipRegWord; /* Private part */ HIMIP himipPrivate; }
where
ulSize
IMI_CI_PMCALLABLE(0x00000001)
Bit 0-4 : NLS Layer mode.
IMI_CM_AUTOMATIC
Note: IME should check client information such as hwnd and SessionID even if IME does not set IME_CAPS_SCREENSWITCHABLE on each IMInstance request, because application can associate the instance to any client at any time.