Moving the IME candidate window to desired position doesn't work

thebluetropics 1,046 Reputation points

I am using IMM (Input Method Manager) to work with IME in my program. Here is my code to move the IME candidate window when the candidate window is about to open:

    if (wparam == IMN_OPENCANDIDATE) {
        HIMC himc = ImmGetContext(_phwnd);

        cf.dwIndex = 0;
        cf.dwStyle = CFS_FORCE_POSITION;
        cf.ptCurrentPos.x = 100;
        cf.ptCurrentPos.y = 0;

        ImmSetCandidateWindow(himc, &cf);
        ImmReleaseContext(_phwnd, himc);

        return 0;
    return DefWindowProcW(_phwnd, msg, wparam, lparam);

This code doesn't work, I don't know why. I think that's because the IME has it's own positioning system and they override it somehow. If so, how do I correctly control the IME window?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,407 questions
{count} votes