在用C#做一个日语学习软件。现在在做一个功能,就是当用户输入日语,截获一个输入字母全部改成K再继续拼接譬如用户输入ra,那就变成ka 拼接成か我现在调用ImmSetCompositionString()函数来实现,调用是成功的,但是变成K以后不能继续拼接了,搞了一个上午不知道如何实现。。具体代码:IntPtr hIMEWnd = ImmGetContext(this.textBox2.Handle);int sz = ImmGetCompositionString(hIMEWnd, GCS_COMPREADSTR, null, 0);StringBuilder strcomp = new StringBuilder(sz);int lpConversion = 0; int lpSentence = 0;
// Get the current conversion status
ImmGetConversionStatus(hIMEWnd, ref lpConversion, ref lpSentence);
// Get the current composition string to str value
ImmGetCompositionString(hIMEWnd, GCS_COMPSTR, strcomp, strcomp.Capacity);
// Set the current converstion status
int result = ImmSetConversionStatus(hIMEWnd, lpConversion, lpSentence);// Set the current composition string
result = ImmSetCompositionString(hIMEWnd, SCS_SETSTR, strcomp, sz, null, 0);