我刚用API写了个,以下是输入法代码,更多的请查询一下注册表
HKEY_USERS/.DEFAULT/keyboard layout/preload
/*
00000804 - 英文输入 E00E0804 - 微软拼音2003 ... */
ActivateIME("E0010804");//激活 "微软拼音2003 " 输入法
//我写的代码,直接可用
|
const int KLF_ACTIVATE = 0x001; const int KLF_SETFORPROCESS = 0x100; [DllImport("user32")] public static extern int LoadKeyboardLayout(string pwszKLID, int flags); [DllImport("user32")] public static extern int ActivateKeyboardLayout(int HKL, int flags); public static void ActivateIME(string imeCode) { int hkl = LoadKeyboardLayout(imeCode, KLF_ACTIVATE); ActivateKeyboardLayout(hkl, KLF_SETFORPROCESS); }