[求助]汉字传拼音的问题。
google到的通过输入法查汉字拼音的代码,咋就是偏要出异常呢????
谁有个能用的例子给偶一下呢,拜谢了。
A call to PInvoke function 'Test!Test.ClassIME_Spell_Full::ImmEnumRegisterWord ' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
查了下原型,没有写错吧~~~ -,-
class ClassIME_Spell_Full
{
public ClassIME_Spell_Full()
{
}
public const uint IME_REGWORD_STYLE_USER_FIRST = 0x80000000;
private string result, srcstring = "字 ";
public delegate void Mycallback(string lpszReading, uint dwStyle, string lpszString, object o);
public Mycallback myc;
[DllImport( "imm32.dll ")]
public static extern uint ImmEnumRegisterWord(uint hkl, Mycallback lpfnEnumProc, string lpszReading, uint dwStyle, string lpszRegister, object o);
//Call this to register word
public void ImmCall(string[] args)
{
myc = new Mycallback(MyCBProc);
//注册回调函数,srcstring里面存储要查的汉字
uint x = ImmEnumRegisterWord(0xE00E0804, myc, null, IME_REGWORD_STYLE_USER_FIRST+1, srcstring, null);
}
//callback函数,每次回调返回汉字的一个读音(多音字)
public void MyCBProc(string lpszReading, uint dwStyle, string lpszString, object o)
{
result += lpszReading;
}
public static string GetSpellCode(string CnStr)