with SCS_SETRECONVERTSTRING and SCS_QUERYRECONVERTSTRING, the application must allocate the necessary memory for the
structure as well as the composition string buffer. IME should not use
this memory later. If IME starts the process, IME should allocate
necessary memory for the structure and the composition string buffer."""
From this, I think reconversion by scintilla can be implemented, without IMR_RECONVERTSTRING message.
=======================================================================
void ScintillaWin::ImeReconvertFromScintilla() {
// IME Reconvert handled by Scintilla on behalf of IME.
// Assign to VK_F12 temporally.
// This method is not triggerd by IMR_RECONVERTSTRING,
// so no guarantee that SCS_SETRECONVERTSTRING be supported.
if (!(ImmGetProperty(GetKeyboardLayout(0), IGP_SETCOMPSTR) & SCS_CAP_SETRECONVERTSTRING)) {
return ;
}
// IMR_DOCUMENTFEED
unsigned int rcSizeWithout = ImeOnReconvert((LPARAM)NULL);
if (rcSizeWithout <= sizeof(RECONVERTSTRING)) {
return;
}
// IMR_RECONVERTSTRING
std::string rcStructure(rcSizeWithout, '\0');
PRECONVERTSTRING reconvert = (PRECONVERTSTRING) &rcStructure[0];
reconvert->dwSize = rcSizeWithout;
unsigned int rcSizeWith = ImeOnReconvert((LPARAM)reconvert);
// IMR_CONFIRMRECONVERTSTRING
HIMC hIMC = ::ImmGetContext(MainHWND());
if (hIMC) {
::ImmSetCompositionStringW(hIMC, SCS_SETRECONVERTSTRING, reconvert, rcSizeWith, NULL, 0);
::ImmReleaseContext(MainHWND(), hIMC);
}
return;
}