ImmSetCompositionString

The ImmSetCompositionString function sets the characters, attributes, and clauses of the composition and reading strings.

BOOL ImmSetCompositionString(
  HIMC hIMC,        
  DWORD dwIndex,    
  LPCVOID lpComp,   
  DWORD dwCompLen,  
  LPCVOID lpRead,   
  DWORD dwReadLen   
);
 

Parameters

hIMC
Handle to the input context.
dwIndex
Type of information to set. This parameter can be one of one of the following values:
Value Meaning
SCS_SETSTR Sets the composition string, the reading string, or both. At least one of the lpComp and lpRead parameters must point to a valid string. If either string is too long, the IME truncates it.
SCS_CHANGEATTR Sets attributes for the composition string, the reading string, or both. At least one of the lpComp and lpRead parameters must point to a valid attribute array.
SCS_CHANGECLAUSE Sets the clause information for the composition string, the reading string, or both. At least one of the lpComp and lpRead parameters must point to a valid clause information array.

lpComp
Pointer to the buffer containing the information to set for the composition string. The information is as specified by the dwIndex value.
dwCompLen
Size in bytes of the information buffer for the composition string.
lpRead
Pointer to the buffer containing the information to set for the reading string. The information is as specified by the dwIndex value.
dwReadLen
Size, in bytes, of the information buffer for the reading string.

Return Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero.

Remarks

When changing attributes, all characters in a clause must have the same attribute. Converted characters must be either ATTR_CONVERTED or ATTR_TARGET_CONVERTED; unconverted characters either ATTR_INPUT or ATTR_TARGET_NOTCONVERTED.

When changing clause information, only the target clause can be changed and only one boundary of the clause can be changed at a time. The target clause has the ATTR_TARGET_CONVERTED or ATTR_TARGET_NOTCONVERTED attribute.

When the IME completes the changes, it sends a WM_IME_COMPOSITION message to the application notifying it of the changes.

QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 2.0 or later (FE).
  Header: Declared in imm.h.
  Import Library: Use imm32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Input Method Editor Overview, Input Method Editor Functions, WM_IME_COMPOSITION