自己做了个编辑框,想实现只接受字符,屏蔽输入法的功能,怎么做?

tghost333 2005-09-13 07:53:07
我用ImmSetOpenStatus(himc,false)到是好用,但是一按CTRL+空格输入法就又恢复了。
用ImmDisableIME的话,一下把一个Thread的输入法全都屏蔽了,而不是只屏蔽当前的编辑框,而且ImmDisableIME只在win98以后好用,win95不能用,disable后我还不知道怎么恢复,郁闷。
有高手知道怎么办可以很好的控制屏蔽输入法吗?请教!
...全文
851 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhoujiamurong 2006-06-30
  • 打赏
  • 举报
回复
mark
tghost333 2005-09-15
  • 打赏
  • 举报
回复
呵呵,好用,谢谢pomelowu(羽战士)
pomelowu 2005-09-14
  • 打赏
  • 举报
回复
class名出了点问题,不影响哈~
pomelowu 2005-09-14
  • 打赏
  • 举报
回复
哦,可以不用处理WM_INPUTLANGCHANGE。下面的代码用来屏蔽某一个控件的输入法状态。

HIMC m_hImc; // 全局或者成员变量

// Function for Disabling IME
void CMyDialog::DisableIME()
{
HWND hWnd = GetDlgItem(IDC_EDIT1)->m_hWnd;
if (hWnd && IsWindow(hWnd))
{
// Get input context for backup.
m_hImc = ImmGetContext(hWnd);

// Remove association the testing
if (m_hImc)
ImmAssociateContext(hWnd, NULL);

// Release input context
ImmReleaseContext(hWnd, m_hImc);
::SetFocus(hWnd);
}
}


// Function for Enabling IME
void CMyDlg::EnableIME()
{
HWND hWnd = GetDlgItem(IDC_EDIT1)->m_hWnd;
if (hWnd && IsWindow(hWnd))
{
// Enable IME
if (m_hImc)
{
// Associate the input context with testing window
ImmAssociateContext(hWnd, m_hImc);
m_hImc = NULL;
}

::SetFocus(hWnd);
}
}
nkwesley 2005-09-14
  • 打赏
  • 举报
回复
ImmGetOpenStatus
This function checks whether the IME is open or closed.

BOOL WINAPI ImmGetOpenStatus(
HIMC hIMC);
Parameters
hIMC
[in] Handle to the input context.
nkwesley 2005-09-14
  • 打赏
  • 举报
回复
ImmDisableIME
The ImmDisableIME function disables the input method editor (IME) for a thread or all threads in a process.

BOOL ImmDisableIME(
DWORD idThread
);
Kudeet 2005-09-14
  • 打赏
  • 举报
回复
try to use
BOOL ImmDisableIME(DWORD idThread);
tghost333 2005-09-14
  • 打赏
  • 举报
回复
谢谢 pomelowu(羽战士),我先试试.
laiyiling(Knowledge is infinite)和 nkwesley(江南丝竹)两位老兄一定没有仔细看问题,两位说的方法我都试过,只是有问题没有办法解决啊?1
tghost333 2005-09-14
  • 打赏
  • 举报
回复
能说的详细点吗?
pomelowu 2005-09-13
  • 打赏
  • 举报
回复
WindowProc中截获WM_INPUTLANGCHANGE消息……

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧