If the dwIndex parameter of ImeSetCompositionString is SCS_SETSTR, the IME can clean up all of the COMPOSITIONSTR structure of hIMC.
If it is necessary, IME may update the candidate information and generate the candidate messages IMN_OPENCANDIDATE, IMN_CHANGECANDIDATE, or IMN_CLOSECANDIDATE.
If the lpRead parameter of ImeSetCompositionString is available, IME should make the composition string from the reading string that is in lpRead. Then the IME makes the attribute and clause information for both the new composition string and the reading string of lpRead. The IME generates WM_IME_COMPOSITION with (GCS_COMP | GCS_COMPREAD). Sometimes IME needs to make it finalize automatically. In this case, the IME may generate WM_IME_COMPOSITION with (GCS_RESULT | GCS_RESULTREAD) instead of GCS_COMPxxx.
If the lpComp parameter of ImeSetCompositionString is available, the IME should make the composition attribute and clause information from the composition string in lpComp. The IME generates WM_IME_COMPOSITION with GCS_COMP. If the IME has the capability of SCS_CAP_MAKEREAD, the IME should make new reading string at same time. The IME generates WM_IME_COMPOSITION with (GCS_COMP | GCS_COMPREAD). Sometimes IME needs to make it finalize automatically. In this case, the IME may generate WM_IME_COMPOSITION with (GCS_RESULT | GCS_RESULTREAD) instead of GCS_COMPxxx.
If both the lpRead and lpComp parameters are available, the IME should make the composition string and the reading string. At this time, IME does not need to follow lpComp and lpRead completely. If IME cannot make the relation between lpRead and lpComp that is specified by the application, the IME should correct the composition string. The IME makes the attribute and clause information for both the new composition string and the reading string of lpRead. The IME generates WM_IME_COMPOSITION with (GCS_COMP | GCS_COMPREAD). Sometimes, IME needs to make it finalize automatically. Then the IME may generate WM_IME_COMPOSITION with (GCS_RESULT | GCS_RESULTREAD) instead of GCS_COMPxxx.