当前位置:编程学习 > C#/ASP.NET >>

会用ImmSetCompositionString()API函数的大哥进来帮忙

在用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);

--------------------编程问答-------------------- 有人么? --------------------编程问答-------------------- ding
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,