What is the second parameter of ImmGetCompositionString?

thebluetropics 50 Reputation points
2023-02-07T10:15:03.87+00:00

The documentation is missing information of some parameters in some function. The function ImmGetCompositionString is not well documented: https://learn.microsoft.com/en-us/windows/win32/api/imm/nf-imm-immgetcompositionstringw

Even the first parameter, I had to read the documentation one by one to found that HIMC can be retrieved using ImmGetContext(hwnd);

What I am trying is to get a Composition String with IMM (Input Method Manager):
User's image

I have tried this:

HIMC handleImc = ImmGetContext(hwnd);
wchar_t tempStr[1024];
ZeroMemory(tempStr, sizeof(tempStr));

// I don't know what is the second parameter used for, so I type zero:
int result = ImmGetCompositionStringW(handleImc, 0, tempStr, 1024);

// result is -2, according to the documentation, it means IMM_ERROR_GENERAL

It doesn't work and returns error, as expected, because I don't know what is the second parameter used for.

Help me,

Regards, thebluetropics.

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,729 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 119.7K Reputation points
    2023-02-07T12:52:21.2666667+00:00

    Probably the values are:

    Also see the lParam of WM_IME_COMPOSITION.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.