How to control the IME

IME is associated with IM Instance. To control the IME, application needs a handle of the IM Instance.

There is a sample.

ULONG ConvertStringSample(HWND hwnd, PSZ pSrcString,
                          PCANDIDATELISTHEADER pBuffer PULONG pulBufLen, ULONG ulFlag)
{
        HIMI himi, *pprehimi;

        rc = ImCreateInstance(&himi);
        if(rc == NO_ERROR) {

                rc = ImAssociateInstance(hwnd, himi,pprehimi);
                if(rc == NO_ERROR) {

                        rc = ImGetInstance(hwnd, &himi);
                        if(rc == NO_ERROR) {

                                rc = ImConvertString(himi,
                                                           pSrcString,
                                                           pBuffer,
                                             pulBufLen,
                                                   ulFlag);

                                ImReleaseInstance(hwnd, himi);
                        }
                }
        ImDestroyInstance(himi);


        }

        return rc;
}


[Back: Overview]
[Next: APIs]