reconversion key 만들기

14 views
Skip to first unread message

johnsonj

unread,
May 8, 2023, 4:09:02 AM5/8/23
to 파이썬문서고
https://msdn.microsoft.com/en-us/library/windows/desktop/dd319107%28v=vs.85%29.aspx
"""If an application starts the reconversion process by calling ImmSetCompositionString with SCS_SETRECONVERTSTRING and SCS_QUERYRECONVERTSTRING, the application must allocate the necessary memory for the RECONVERTSTRING 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.
Why not?

=======================================================================
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;
}

johnsonj

unread,
May 10, 2023, 12:49:56 AM5/10/23
to 파이썬문서고
작동을 안하네..허허..어디가 잘못되었을꼬.. 바뀐거 없는데

2023년 5월 8일 월요일 오후 5시 9분 2초 UTC+9에 johnsonj님이 작성:
Message has been deleted
Message has been deleted

johnsonj

unread,
May 15, 2023, 3:57:38 AM5/15/23
to 파이썬문서고
void ScintillaWin::ImeReconvertKey() {
// Check if Ime supports reconversion.

if (!(ImmGetProperty(GetKeyboardLayout(0), IGP_SETCOMPSTR) & SCS_CAP_SETRECONVERTSTRING))
return ;
if (pdoc->TentativeActive())
return;

unsigned int rcSize = ImeOnReconvert((LPARAM)NULL);
if (rcSize <= sizeof(RECONVERTSTRING)) {
return;
}

std::vector <char> rcStruct(rcSize, '\0');
PRECONVERTSTRING rc = (PRECONVERTSTRING) &rcStruct[0];

rc->dwSize = rcSize;
rcSize = ImeOnReconvert((LPARAM)rc);


HIMC hIMC = ::ImmGetContext(MainHWND());
if (hIMC) {
::ImmSetCompositionStringW(hIMC, SCS_SETRECONVERTSTRING, rc, rcSize, NULL, 0);
::ImmReleaseContext(MainHWND(), hIMC);
}
return;
}



2023년 5월 10일 수요일 오후 1시 49분 56초 UTC+9에 johnsonj님이 작성:
Reply all
Reply to author
Forward
0 new messages